uninstalling a selected port ...

Jason Swails jason.swails at gmail.com
Fri Feb 28 06:17:19 PST 2014


On Fri, 2014-02-28 at 14:53 +0100, Peter Danecek wrote:
> On 28 Feb 2014, at 14:44, Jason Swails <jason.swails at gmail.com> wrote:
> 
> > On Fri, 2014-02-28 at 14:33 +0100, Peter Danecek wrote:
> >> Hi all,
> >> 
> >> I observe a behaviour, which I believe is due to the fact that I
> >> uninstalled an selected port (see below). This seems to leave the
> >> selection mechanism in an undesired state and should be handled. Now I
> >> wonder which is the expected behaviour, so that I can eventually file
> >> a ticket against the right component.
> >> 
> >> Thanks!
> >> 
> >> --- snip ---
> >> 
> >> petr% sudo port select --list postgresql
> >> Available versions for postgresql:
> >> 	none (active)
> >> 	postgresql93
> >> 
> >> petr% sudo port select --set postgresql postgresql93 
> >> Selecting 'postgresql93' for 'postgresql' failed: symlink: /opt/local/etc/select/postgresql/current-> postgresql93: file already exists
> > 
> > Try forcing the issue.
> > 
> > sudo port -f select --set postgresql postgresql93
> > 
> > In my opinion, such protection is a Good Thing (TM).  There's a way to
> > work around it if you know the reason behind the file collision, but I
> > certainly wouldn't want a program (especially one I run as root) to go
> > around clobbering existing files without me knowing it.
> 
> Well, I understand your point and it would be fine if it is decided to
> leave ALL untouched.
> But then in expect consistent information, i.e. all should be left
> pointing to `postgresql92` (even if it does not exist), so at least
> you know the status. If I am informed that it point to `none` this
> should be the case. 

I believe it is consistent.  As I understand it, the simlinks created by
"port select" are not *owned* by the selected port.  Since the port
itself does not maintain these simlinks (but rather 'port select' does),
there are good arguments to be made that the port should _not_ own
simlinks created by select.  As a result, uninstalling that port should
not touch those simlinks.  This results in the errors you saw.

An alternative when you know that you are uninstalling a port is to
select none.  So something like

sudo port select --set postgresql none

to get rid of the simlinks, then another

sudo port select --set postgresql postgresql93

to set the simlinks to the new version you want to track.  (This
approach is untested, but I think it should work.)  A feature request
may be for "port select" to detect dangling links and print an
informative message (perhaps with a suggested command to eliminate the
dangling links).  That's largely aesthetic, though.

All the best,
Jason

-- 
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher



More information about the macports-users mailing list