Opened 13 years ago

Closed 8 years ago

Last modified 8 years ago

#31702 closed defect (fixed)

port select fails if symlink already exists from earlier installation or from uninstalled port

Reported by: gthb (Gunnlaugur Thor Briem) Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.4.1
Component: base Version: 2.0.3
Keywords: Cc: neverpanic (Clemens Lang), jyrkiwahlstedt, dbevans (David B. Evans), larryv (Lawrence Velázquez), ryandesign (Ryan Carsten Schmidt), Themanwithoutaplan, mojca (Mojca Miklavec), brookemgilbert@…, poorsod@…, tim@…, keybounce, lukasz@…, DavidBAEpstein, nhojpatrick (John Patrick)
Port:

Description

This command:

sudo port select python python26

is failing with the output:

Selecting 'python26' for 'python' failed: symlink: /opt/local/etc/select/python/current -> python26: file already exists

The timestamp on /opt/local/etc/select/python/current is August 3. But I nuked my whole MacPorts setup yesterday in accordance with Migration. So after uninstalling all python versions and reinstalling MacPorts itself, this symlink remains, and interferes with port select.

I hit the same problem with port select gcc42 so it seems to be a general MacPorts problem, not specific to python.

Attachments (1)

patch-src-symlink.in.diff (1.2 KB) - added by gauravb7090@… 11 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 13 years ago by gthb (Gunnlaugur Thor Briem)

... this is on Lion with XCode 4.2, in case that matters.

comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Not surprising. Delete those symlinks.

comment:3 Changed 13 years ago by gthb (Gunnlaugur Thor Briem)

Sure, the workaround is straightforward :) ... but still those symlinks should be removed when the corresponding ports are uninstalled. (Yeah, the title of this bug could have been better...)

Changed 11 years ago by gauravb7090@…

Attachment: patch-src-symlink.in.diff added

comment:4 Changed 9 years ago by akimd (Akim Demaille)

I have migrated from Python 3.4 to Python 3.5, but although there is no longer pip-3.4 installed on my machine:

$ port installed | grep pip
  pip_select @0.1_0 (active)
  py35-pip @8.1.1_0 (active)

there is still a symlink installed:

$ ls -l /opt/local/etc/select/pip/current
lrwxr-xr-x  1 root  admin  5  6 mar  2015 /opt/local/etc/select/pip/current -> pip34

that select does not seem to see:

$ sudo port select --summary
Name       Selected      Options
====       ========      =======
autopep8   none          autopep8-34 none
awscli     none          py34-awscli none
clang      none          mp-clang-3.4 mp-clang-3.5 mp-clang-3.6 mp-clang-3.7 mp-clang-3.8 none
cython     none          cython27 cython34 none
gcc        none          mp-gcc49 mp-gcc5 mp-gcc6 none
ipython    none          py34-ipython py35-ipython none
ipython3   py35-ipython  py34-ipython py35-ipython none
llvm       none          mp-llvm-3.4 mp-llvm-3.5 mp-llvm-3.6 mp-llvm-3.7 mp-llvm-3.8 none
nosetests  none          nosetests27 nosetests34 none
pep8       none          pep8-34 none
pip        none          pip35 none
python     python35      python26-apple python27 python27-apple python34 python35 none
python2    none          python27 none
python3    python34      python34 python35 none
sphinx     py34-sphinx   py34-sphinx none
wxWidgets  none          wxWidgets-3.0 none

so it fails to upgrade my selection:

$ sudo port select --set pip pip35
Selecting 'pip35' for 'pip' failed: symlink: /opt/local/etc/select/pip/current -> pip35: file already exists

Sure, I could do that by hand, but I shouldn't have to do that.

comment:5 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: neverpanic jyrkiwahlstedt dbevans larryv ryandesign charlie.clark@… mojca brookemgilbert@… poorsod@… tim@… keybounce lukasz@… David.Epstein@… nhojpatrick added
Summary: port select fails if symlink already exists from earlier installationport select fails if symlink already exists from earlier installation or from uninstalled port

Has duplicates #47755 (with much discussion) and #53109.

comment:6 Changed 8 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: newclosed

In 9389e83/macports-base:

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: #31702

comment:7 Changed 8 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.4.1
Note: See TracTickets for help on using tickets.