On Dec 22, 2019, at 04:13, Michael Newman wrote:

> When I got up this morning I found that a couple of scripts that I run 
> overnight had failed with error 127. It seems that the scripts couldn’t find 
> curl. So I checked, and sure enough, curl was missing. No worries, I can 
> reinstall it.
> 
> And then I wonder, what else is missing? I try: 
> 
>  port list installed 

Note that "port list installed" is not the command you want to run. It does not 
tell you what you think it tells you. You want to run "port installed" instead. 
See:

https://trac.macports.org/wiki/FAQ#portlist


> and find that there are only two ports: lynx which I installed yesterday and 
> curl which I had just installed.
> 
> What happened? Well, just before installing lynx I did a selfupdate and 
> upgrade. At the end of the upgrade I was invited to do a reclaim. So, I did. 
> Now, admittedly, reclaim presented me with a huge long list of stuff it was 
> going to remove.  Whenever I look at all the ports on my machine I only 
> recognize a handful; most are things I know nothing about and never 
> requested, they’re just stuff that the ports I want depend on. Fair enough. 
> 
> However, it would be nice if reclaim warned you that it was working with an 
> empty or near empty requested file.

There isn't a "requested file"; MacPorts keeps an SQLite database of what you 
have installed (it's called the registry) and each installed port has various 
attributes, including whether you requested it.

We could modify reclaim so that it prints a count of the ports that will be 
kept and a count of the ports that will be removed, in addition to printing the 
list of ports that will be removed. Would that have helped? If so, you could 
file a ticket in our issue tracker for that enhancement, or even implement it 
and submit a pull request.


> I’m sure that as part of the Catalina migration I did:
> 
>  sudo port unsetrequested installed
>  xargs sudo port setrequested < requested.txt
> 
> Either I forgot, or it didn’t work. In any event, apparently every installed 
> port was removed.

I can't imagine that it didn't work, and if it didn't, it should have printed 
an error message that you would have noticed.


> Fortunately, I still had the myports.txt file, so I was able to use:
> 
>  sudo ./restore_ports.tcl myports.txt
> 
> And get everything back.
> 
> I find it a little scary that a few simple mistakes can cause such havoc.

Since reclaim prints a list of the ports it will remove, it seems like it's up 
to you to verify that there isn't anything on the list that you want to keep 
before confirming the action, and it should not be surprising or scary to you 
that MacPorts does then remove the ports it said it would remove if you allow 
it to do so.


Reply via email to