[139170] trunk/base/src/macports1.0/macports.tcl

raimue at macports.org raimue at macports.org
Wed Aug 5 07:23:42 PDT 2015


Revision: 139170
          https://trac.macports.org/changeset/139170
Author:   raimue at macports.org
Date:     2015-08-05 07:23:42 -0700 (Wed, 05 Aug 2015)
Log Message:
-----------
macports1.0: do not treat broken select symlinks as "none"

After uninstalling a port the symlinks created by 'port select' will still
exist in the file system. We should attribute them to the previous selection
instead of 'none' which means no symlinks exist at all.

'file exists' tried to follow the broken symlink, but 'file type' does not and
leads to the expected result.

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2015-08-05 13:39:21 UTC (rev 139169)
+++ trunk/base/src/macports1.0/macports.tcl	2015-08-05 14:23:42 UTC (rev 139170)
@@ -4384,7 +4384,10 @@
         show {
             set selected_version ${conf_path}/current
 
-            if {![file exists $selected_version]} {
+            if {[catch {file type $selected_version} err]} {
+                # this might be okay if nothing was selected yet,
+                # just log the error for debugging purposes
+                ui_debug "cannot determine selected version for $group: $err"
                 return none
             } else {
                 return [file readlink $selected_version]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150805/4452158d/attachment.html>


More information about the macports-changes mailing list