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, [email protected] wrote: > > Revision > 129924 <https://trac.macports.org/changeset/129924>Author > [email protected] <mailto:[email protected]>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 > [email protected] > <mailto:[email protected]> > https://lists.macosforge.org/mailman/listinfo/macports-changes > <https://lists.macosforge.org/mailman/listinfo/macports-changes>
_______________________________________________ macports-dev mailing list [email protected] https://lists.macosforge.org/mailman/listinfo/macports-dev
