Command line glob expansion broken-ish
Ryan Schmidt
ryandesign at macports.org
Fri May 21 03:49:05 UTC 2021
On May 20, 2021, at 08:28, Bill Cole wrote:
> On 2021-05-20 at 02:10:39 UTC-0400 (Thu, 20 May 2021 01:10:39 -0500) Ryan Schmidt is rumored to have said:
>
>> On May 19, 2021, at 20:43, Bill Cole wrote:
>>
>>> Example:
>>>
>>> shiny:~ root# port installed *proto
>>> The following ports are currently installed:
>>> xorg-xorgproto @2021.4_0
>>> shiny:~ root# port installed |fgrep proto
>>> xorg-compositeproto @0.4.2_0 (active)
>>> xorg-damageproto @1.2.1_0 (active)
>>> xorg-fixesproto @5.0_0 (active)
>>> xorg-kbproto @1.0.7_0 (active)
>>> xorg-randrproto @1.5.0_0 (active)
>>> xorg-renderproto @0.11.1_0 (active)
>>> xorg-xineramaproto @1.2.1_0 (active)
>>> xorg-xorgproto @2021.4_0
>>>
>>> I do understand the issue, I think: the glob is being expanded against the names of ports that still exist in the current ports tree, not the ones that have been installed but have been superseded by (in this case) an omnibus port that won't activate because of the existing installations.
>>>
>>> The obvious workaround was to manually uninstall each of the zombie ports individually. I wonder if anyone else considers this a bug?
>>
>> I believe that's behaving as designed, so it's not a bug.
>
> OK. I can see how that choice makes port-expression handling more efficient. It is probably worth documenting (I know: PRs welcomed...)
I don't think it's necessarily about efficiency. It's just how MacPorts works, how it has always worked. I'm not sure anybody has ever suggested or requested that it should work differently.
The port command accepts global flags, an action name, action-specific flags, and then a port name or pseudo-portname or port expression or port URL. The manual documents what those things mean.
https://man.macports.org/port.1.html
It says:
"portnames containing valid UNIX glob patterns will also expand to the set of matching ports."
It doesn't say right there that it's matching against the ports trees only (and not also any installed ports that are not (or no longer) in the ports trees), but it does say earlier when describing pseudo-portnames:
"port recognizes various pseudo-portnames that will expand to the specified set of ports from the available port tree(s)."
I guess the section on glob patterns could be updated to add such clarification.
>> You can also periodically use
>>
>> sudo port reclaim
>>
>> to reclaim disk space from things that are no longer needed, which might include obsolete ports unless you had explicitly requested them to be installed.
>
> This is a machine whose MacPorts world had seen no attention in many months and probably hasn't been installed from scratch in 5+ years, as it was retired to low-attention duties. I may well have 'setrequested' every installed port at the last major OS update.
Ok. If you've requested all ports, then reclaim will not uninstall them. Simple as that.
More information about the macports-users
mailing list