[129924] trunk/base/src/port1.0/porttrace.tcl
Lawrence Velázquez
larryv at macports.org
Tue Dec 23 08:53:36 PST 2014
Is there a particular reason that you interleaved the handling of "resolvedPath" around the handling of "normalizedPath"?
vq
> On Dec 23, 2014, at 5:27 AM, ionic at macports.org wrote:
>
> Revision
> 129924 <https://trac.macports.org/changeset/129924>Author
> ionic at macports.org <mailto:ionic at macports.org>Date
> 2014-12-23 02:27:30 -0800 (Tue, 23 Dec 2014)
> Log Message
>
> base: handle symlink as basename correctly for trace mode sandbox.
> Modified Paths
>
> trunk/base/src/port1.0/porttrace.tcl <x-msg://86/#trunkbasesrcport10porttracetcl>
> Diff
>
> <>Modified: trunk/base/src/port1.0/porttrace.tcl (129923 => 129924)
>
> --- trunk/base/src/port1.0/porttrace.tcl 2014-12-23 08:07:12 UTC (rev 129923)
> +++ trunk/base/src/port1.0/porttrace.tcl 2014-12-23 10:27:30 UTC (rev 129924)
> @@ -68,10 +68,28 @@
> lappend mapping "=" "\\= <smb://=>"
>
> set normalizedPath [file normalize $path]
> + # file normalize will leave symlinks as the very last
> + # path component intact. This will, for instance, prevent /tmp from
> + # being resolved to /private/tmp.
> + # Also use file readlink to counter this behavior.
> + # file readlink returns an error, if the last component is not
> + # a symlink. Catch that.
> + set resolvedPath {}
> + if {![catch {file readlink $path}]} {
> + set resolvedPath [file readlink $path]
> +
> + if {[string length $resolvedPath] > 0 && [string index $resolvedPath 0] ne "/"} {
> + # Canonicalize.
> + set resolvedPath [file normalize [file dirname $path]/$resolvedPath]
> + }
> + }
> lappend sndbxlst "[string map $mapping $path]=$action"
> if {$normalizedPath ne $path} {
> lappend sndbxlst "[string map $mapping $normalizedPath]=$action"
> }
> + if {[string length $resolvedPath] > 0 && $resolvedPath ne $path} {
> + lappend sndbxlst "[string map $mapping $resolvedPath]=$action"
> + }
> }
>
> ##
> _______________________________________________
> macports-changes mailing list
> macports-changes at lists.macosforge.org <mailto:macports-changes at lists.macosforge.org>
> https://lists.macosforge.org/mailman/listinfo/macports-changes <https://lists.macosforge.org/mailman/listinfo/macports-changes>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-dev/attachments/20141223/c5b48493/attachment.html>
More information about the macports-dev
mailing list