Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mportselect: always delete existing symlinks
If the previously selected port was uninstalled, the 'current' symlink
would be left pointing to the old select file that is no longer
available.

The condition using 'file exists' follows the symlink and checks its
target, not the symlink itself. It is safe to always call 'file delete'
as deletion of a non-existing target is not an error.

Closes: https://trac.macports.org/ticket/31702
(cherry picked from commit 9389e83)
  • Loading branch information
raimue authored and jmroot committed Feb 16, 2017
1 parent a15014b commit 07825b9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/macports1.0/macports.tcl
Expand Up @@ -4285,9 +4285,7 @@ proc mportselect {command {group ""} {version {}}} {

# Update the selected version.
set selected_version ${conf_path}/current
if {[file exists $selected_version]} {
file delete $selected_version
}
file delete $selected_version
symlink $version $selected_version
return
}
Expand Down

0 comments on commit 07825b9

Please sign in to comment.