Skip to content

Commit

Permalink
mportselect: always delete existing symlinks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
raimue committed Feb 2, 2017
1 parent 8f8bead commit 9389e83
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 9389e83

Please sign in to comment.