Revision
140682
Author
jmr@macports.org
Date
2015-09-29 23:02:47 -0700 (Tue, 29 Sep 2015)

Log Message

avoid error due to calling realpath on nonexistent files

Modified Paths

Diff

Modified: trunk/base/src/port1.0/porttrace.tcl (140681 => 140682)


--- trunk/base/src/port1.0/porttrace.tcl	2015-09-30 05:50:10 UTC (rev 140681)
+++ trunk/base/src/port1.0/porttrace.tcl	2015-09-30 06:02:47 UTC (rev 140682)
@@ -71,7 +71,11 @@
         # path component intact. This will, for instance, prevent /tmp from
         # being resolved to /private/tmp.
         # Use realpath to avoid this behavior.
-        set normalizedPath [realpath $path]
+        set normalizedPath [file normalize $path]
+        # realpath only works on files that exist
+        if {![catch {file type $normalizedPath}]} {
+            set normalizedPath [realpath $normalizedPath]
+        }
         lappend sndbxlst "[string map $mapping $path]=$action"
         if {$normalizedPath ne $path} {
             lappend sndbxlst "[string map $mapping $normalizedPath]=$action"