Re: Reclaim was not 'safe'

2021-05-12 Thread Ryan Schmidt
On May 11, 2021, at 02:28, Gerben Wierda wrote:

> On 11 May 2021, at 01:11, Ryan Schmidt wrote:
> 
>> The port-reclaim(1) manpage and `port help reclaim` say:
>> 
>> "port reclaim will find files that can be removed to reclaim disk space by 
>> uninstalling inactive ports on your system as well as unnecessary 
>> unrequested ports, and removing unneeded or unused installation files. The 
>> user is then provided interactive options for files to remove. No files are 
>> removed initially, until the user selects them from the provided list."
> 
> When I wrote “man page/help of reclaim said it would not remove active 
> installs” I should have written “man page/help said of/about reclaim it would 
> not remove active installs”. I did not say ‘port help reclaim’ or man 
> port-reclaim’. I used the main ‘man port’. 
> 
> Where the flag is described ‘port help’ or 'man port' only says:
> 
>reclaim
>Reclaims disk space by uninstalling inactive ports and removing 
> unneeded installation files.
> 
> It doesn’t mention that it removes anything but inactive ports. This is what 
> made me not care about lists being presented. Beside, tThe list was huge, 
> most of it py38 or p5 somethings. So, I trusted that statement (which turned 
> out to be not completely true)
> 
> My suggestion would be to adapt the main port help.

Thanks for clarifying. I agree we should fix the wording of the main manpage.



Re: Reclaim was not 'safe'

2021-05-12 Thread Ryan Schmidt



On May 12, 2021, at 18:02, raf wrote:

> On Wed, May 12, 2021 at 02:44:38PM -0400, Bill Cole wrote:
> 
>> On 2021-05-10 at 12:47:35 UTC-0400 (Mon, 10 May 2021 09:47:35 -0700)
>> Ken Cunningham is rumored to have said:
>> 
 Isn't that just sudo port setrequested installed
>>> 
>>> That’s what I’ve always done to avoid this, also having been burned by
>>> it once years ago:
>>> 
>>> sudo port setrequested installed
>> 
>> That basically eliminates the first stage of "reclaim" from ever doing
>> anything, which may not be a bad idea as it currently stands. Also, it is
>> probably better to use 'active' rather than 'installed' as there's no point
>> in marking deactivated ports (generally speaking: old versions) as
>> requested.

Requested status applies to port names only and is independent of the version, 
variants, or other attributes of the port.


> It would probably make most sense to only setrequested
> those active unrequested ports that you use directly
> (i.e. not everything that is depended upon by requested
> ports that you use directly).
> 
> In other words, if a port was installed as a
> prerequisite of a port you want, and then you started
> using that prerequisite port independently of the
> originally wanted port, then that prerequisite port
> should be setrequested. But other prerequisite ports
> shouldn't be setrequested.

Correct.




Re: Reclaim was not 'safe'

2021-05-12 Thread raf
On Wed, May 12, 2021 at 02:44:38PM -0400, Bill Cole 
 wrote:

> On 2021-05-10 at 12:47:35 UTC-0400 (Mon, 10 May 2021 09:47:35 -0700)
> Ken Cunningham 
> is rumored to have said:
> 
> > > Isn't that just sudo port setrequested installed
> > 
> > That’s what I’ve always done to avoid this, also having been burned by
> > it once years ago:
> > 
> > sudo port setrequested installed
> 
> That basically eliminates the first stage of "reclaim" from ever doing
> anything, which may not be a bad idea as it currently stands. Also, it is
> probably better to use 'active' rather than 'installed' as there's no point
> in marking deactivated ports (generally speaking: old versions) as
> requested.
> 
> -- 
> Bill Cole
> b...@scconsult.com or billc...@apache.org
> (AKA @grumpybozo and many *@billmail.scconsult.com addresses)
> Not Currently Available For Hire

It would probably make most sense to only setrequested
those active unrequested ports that you use directly
(i.e. not everything that is depended upon by requested
ports that you use directly).

In other words, if a port was installed as a
prerequisite of a port you want, and then you started
using that prerequisite port independently of the
originally wanted port, then that prerequisite port
should be setrequested. But other prerequisite ports
shouldn't be setrequested.

cheers,
raf



Re: Reclaim was not 'safe'

2021-05-12 Thread Bill Cole

On 2021-05-10 at 12:47:35 UTC-0400 (Mon, 10 May 2021 09:47:35 -0700)
Ken Cunningham 
is rumored to have said:


Isn't that just sudo port setrequested installed


That’s what I’ve always done to avoid this, also having been 
burned by it once years ago:


sudo port setrequested installed


That basically eliminates the first stage of "reclaim" from ever doing 
anything, which may not be a bad idea as it currently stands. Also, it 
is probably better to use 'active' rather than 'installed' as there's no 
point in marking deactivated ports (generally speaking: old versions) as 
requested.


--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire


Re: Reclaim was not 'safe'

2021-05-11 Thread Gerben Wierda via macports-users

> On 11 May 2021, at 01:11, Ryan Schmidt  wrote:
> 
> 
> 
> On May 9, 2021, at 17:07, Gerben Wierda wrote:
> 
>> I relied on the fact that man page/help of reclaim said it would not remove 
>> active installs. So, having read that, I assumed it was unable to damage the 
>> running setup and I assumed it would only remove everything inactive, 
>> compile stuff, etc.
>> 
>> That was a mistake I now know. Reclaim will remove active unrequested 
>> installs. But the help/man does not say so.
> 
> I'm really sorry that it uninstalled ports that you needed; that's really not 
> helpful.
> 
> The port-reclaim(1) manpage and `port help reclaim` say:
> 
> "port reclaim will find files that can be removed to reclaim disk space by 
> uninstalling inactive ports on your system as well as unnecessary unrequested 
> ports, and removing unneeded or unused installation files. The user is then 
> provided interactive options for files to remove. No files are removed 
> initially, until the user selects them from the provided list."

When I wrote “man page/help of reclaim said it would not remove active 
installs” I should have written “man page/help said of/about reclaim it would 
not remove active installs”. I did not say ‘port help reclaim’ or man 
port-reclaim’. I used the main ‘man port’. 

Where the flag is described ‘port help’ or 'man port' only says:

   reclaim
   Reclaims disk space by uninstalling inactive ports and removing 
unneeded installation files.

It doesn’t mention that it removes anything but inactive ports. This is what 
made me not care about lists being presented. Beside, tThe list was huge, most 
of it py38 or p5 somethings. So, I trusted that statement (which turned out to 
be not completely true)

My suggestion would be to adapt the main port help.


Gerben Wierda (LinkedIn )
R Enterprise Architecture  (main site)
Book: Chess and the Art of Enterprise Architecture 
Book: Mastering ArchiMate 

> 
> So it clearly says it will uninstall unrequested ports that are no longer 
> needed, which users are expected to have no problem with; in fact, this 
> functionality is one of the reasons why users are expected to want to run 
> reclaim: to reclaim disk space for things that are no longer needed. And it 
> says it will show you the list of everything it will uninstall before it does 
> it. So you have an opportunity to cancel before it does that. I'm not sure 
> how much more we can do to save the user from uninstalling things they didn't 
> mean to uninstall. Do you have a suggestion?
> 
> Users should definitely look through the output of `port installed 
> unrequested` and make sure that it does not contain anything you actually 
> want. If it does, use `sudo port setrequested` to tell MacPorts which ones 
> you actually do want, as Daniel said. Conversely, look through the output of 
> `port installed requested` and if anything is listed that you don't actually 
> want, use `sudo port unsetrequested` to mark it as not needed.



Re: Reclaim was not 'safe'

2021-05-10 Thread Ryan Schmidt



On May 9, 2021, at 17:07, Gerben Wierda wrote:

> I relied on the fact that man page/help of reclaim said it would not remove 
> active installs. So, having read that, I assumed it was unable to damage the 
> running setup and I assumed it would only remove everything inactive, compile 
> stuff, etc.
> 
> That was a mistake I now know. Reclaim will remove active unrequested 
> installs. But the help/man does not say so.

I'm really sorry that it uninstalled ports that you needed; that's really not 
helpful.

The port-reclaim(1) manpage and `port help reclaim` say:

"port reclaim will find files that can be removed to reclaim disk space by 
uninstalling inactive ports on your system as well as unnecessary unrequested 
ports, and removing unneeded or unused installation files. The user is then 
provided interactive options for files to remove. No files are removed 
initially, until the user selects them from the provided list."

So it clearly says it will uninstall unrequested ports that are no longer 
needed, which users are expected to have no problem with; in fact, this 
functionality is one of the reasons why users are expected to want to run 
reclaim: to reclaim disk space for things that are no longer needed. And it 
says it will show you the list of everything it will uninstall before it does 
it. So you have an opportunity to cancel before it does that. I'm not sure how 
much more we can do to save the user from uninstalling things they didn't mean 
to uninstall. Do you have a suggestion?

Users should definitely look through the output of `port installed unrequested` 
and make sure that it does not contain anything you actually want. If it does, 
use `sudo port setrequested` to tell MacPorts which ones you actually do want, 
as Daniel said. Conversely, look through the output of `port installed 
requested` and if anything is listed that you don't actually want, use `sudo 
port unsetrequested` to mark it as not needed.

Re: Reclaim was not 'safe'

2021-05-10 Thread Ken Cunningham
> Isn't that just sudo port setrequested installed 

That’s what I’ve always done to avoid this, also having been burned by it once 
years ago:

sudo port setrequested installed
sudo port -v reclaim

K

Re: Reclaim was not 'safe'

2021-05-10 Thread Bill Cole

On 2021-05-10 at 11:43:56 UTC-0400 (Mon, 10 May 2021 17:43:56 +0200)
Bjarne D Mathiesen 
is rumored to have said:


Daniel J. Luke wrote:
On May 9, 2021, at 12:20 PM, Gerben Wierda via macports-users 
 wrote:
Anyway, the hard lesson was: reclaim is not ’safe’. I  thought, 
reclaim would only remove inactive installs, but it removed active 
ones as well.


It is not possible for me to retrace what went wrong exactly, sadly.


The first thing reclaim does is this:

--->  Checking for unnecessary unrequested ports
Unrequested ports without requested dependents found:

If you (like me) have an MacPorts install that pre-dates the 
requested flag, you'll have a bunch of ports in that list that you 
don't actually want uninstalled. For reclaim to work best, you need 
to do `port setrequested` on the ports you want to always keep - then 
the list of ports you see there will be stuff that got installed that 
you no longer need. (You can also mark things 'unrequested', see the 
port manpage - so you can fix things up if you mistakenly mark 
something requested that you don't want).


Or, you can just hit 'n' for the first prompt.



so, doing something like this :

port -q installed \


Better:

  port -q installed active \

Since the 'installed' pseudo-port includes deactivated ports, which are 
left by default after upgrades.



| awk '{print $1}' \
| xargs -n1 port setrequested

before the first use of 'port reclaim' would be advisable

I (luckily) didn't get burned, but I deemed 'port reclaim' to be 
unsafe

in automatic update scripts. In my case eg git was set up for reclaim.

--
Bjarne D Mathiesen
Korsør ; Danmark ; Europa
---
denne besked er skrevet i et totalt M$-frit miljø
OpenCore + macOS 10.15.7 Catalina
MacPro 2010 ; 2 x 3,46 GHz 6-Core Intel Xeon ; 256 GB 1333 MHz DDR3 
ECC

ATI Radeon RX 590 8 GB



--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire


Re: Reclaim was not 'safe'

2021-05-10 Thread Randal L. Schwartz
> "Bjarne" == Bjarne D Mathiesen  writes:


Bjarne> port -q installed \
Bjarne> | awk '{print $1}' \
Bjarne> | xargs -n1 port setrequested

Isn't that just

   sudo port setrequested installed

Or am I missing something?
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Dart/Flutter consulting, Technical writing, Comedy, etc. etc.
Still trying to think of something clever for the fourth line of this .sig


Re: Reclaim was not 'safe'

2021-05-10 Thread Bjarne D Mathiesen



Daniel J. Luke wrote:
> On May 9, 2021, at 12:20 PM, Gerben Wierda via macports-users 
>  wrote:
>> Anyway, the hard lesson was: reclaim is not ’safe’. I  thought, reclaim 
>> would only remove inactive installs, but it removed active ones as well.
>>
>> It is not possible for me to retrace what went wrong exactly, sadly.
> 
> The first thing reclaim does is this:
> 
> --->  Checking for unnecessary unrequested ports
> Unrequested ports without requested dependents found:
> 
> If you (like me) have an MacPorts install that pre-dates the requested flag, 
> you'll have a bunch of ports in that list that you don't actually want 
> uninstalled. For reclaim to work best, you need to do `port setrequested` on 
> the ports you want to always keep - then the list of ports you see there will 
> be stuff that got installed that you no longer need. (You can also mark 
> things 'unrequested', see the port manpage - so you can fix things up if you 
> mistakenly mark something requested that you don't want).
> 
> Or, you can just hit 'n' for the first prompt.
> 

so, doing something like this :

port -q installed \
| awk '{print $1}' \
| xargs -n1 port setrequested

before the first use of 'port reclaim' would be advisable

I (luckily) didn't get burned, but I deemed 'port reclaim' to be unsafe
in automatic update scripts. In my case eg git was set up for reclaim.

-- 
Bjarne D Mathiesen
Korsør ; Danmark ; Europa
---
denne besked er skrevet i et totalt M$-frit miljø
OpenCore + macOS 10.15.7 Catalina
MacPro 2010 ; 2 x 3,46 GHz 6-Core Intel Xeon ; 256 GB 1333 MHz DDR3 ECC
ATI Radeon RX 590 8 GB


Re: Reclaim was not 'safe'

2021-05-10 Thread Daniel J. Luke
I agree that the implementation could be better - it doesn't look 
super-complicated, perhaps making this less surprising/less destructive would 
be a good first project for someone interested in working on macports-base?

> On May 10, 2021, at 3:53 AM, Richard L. Hamilton  wrote:
> Too late now, but IMO, if it had been three state (tag absent as well as 
> unrequested and requested values) from the first introduction of that tag, 
> and automatic assignment of "unrequested" was conservative enough, then one 
> wouldn't have to tag everything one wanted to keep as requested. In other 
> words, ports already installed at the time of the introduction of the tag 
> could have been handled differently from those installed later. Also, some 
> ports that seem just meta-ports to install a bunch of others (like kdegames4) 
> should IMO, if explicitly installed, tag all the ports they install that are 
> not just build-time dependencies as requested (if they don't already - I 
> don't know when the tag was added, nor when I installed kdegames4).
> 
>> On May 10, 2021, at 01:13, Randal L. Schwartz  wrote:
>> 
>>> "Gerben" == Gerben Wierda via macports-users 
>>>  writes:
>> 
>> Gerben> That was a mistake I now know. Reclaim will remove active unrequested
>> Gerben> installs. But the help/man does not say so.
>> 
>> Let me just say that as a long-time Macports user, I also got burned
>> badly by this.

-- 
Daniel J. Luke



Re: Reclaim was not 'safe'

2021-05-10 Thread Richard L. Hamilton
Too late now, but IMO, if it had been three state (tag absent as well as 
unrequested and requested values) from the first introduction of that tag, and 
automatic assignment of "unrequested" was conservative enough, then one 
wouldn't have to tag everything one wanted to keep as requested. In other 
words, ports already installed at the time of the introduction of the tag could 
have been handled differently from those installed later. Also, some ports that 
seem just meta-ports to install a bunch of others (like kdegames4) should IMO, 
if explicitly installed, tag all the ports they install that are not just 
build-time dependencies as requested (if they don't already - I don't know when 
the tag was added, nor when I installed kdegames4).

> On May 10, 2021, at 01:13, Randal L. Schwartz  wrote:
> 
>> "Gerben" == Gerben Wierda via macports-users 
>>  writes:
> 
> Gerben> That was a mistake I now know. Reclaim will remove active unrequested
> Gerben> installs. But the help/man does not say so.
> 
> Let me just say that as a long-time Macports user, I also got burned
> badly by this.
> 
> -- 
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
>  http://www.stonehenge.com/merlyn/>
> Perl/Dart/Flutter consulting, Technical writing, Comedy, etc. etc.
> Still trying to think of something clever for the fourth line of this .sig
> 

-- 
eMail:  mailto:rlha...@smart.net






Re: Reclaim was not 'safe'

2021-05-09 Thread Randal L. Schwartz
> "Gerben" == Gerben Wierda via macports-users 
>  writes:

Gerben> That was a mistake I now know. Reclaim will remove active unrequested
Gerben> installs. But the help/man does not say so.

Let me just say that as a long-time Macports user, I also got burned
badly by this.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Dart/Flutter consulting, Technical writing, Comedy, etc. etc.
Still trying to think of something clever for the fourth line of this .sig


Re: Reclaim was not 'safe'

2021-05-09 Thread Gerben Wierda via macports-users
I relied on the fact that man page/help of reclaim said it would not remove 
active installs. So, having read that, I assumed it was unable to damage the 
running setup and I assumed it would only remove everything inactive, compile 
stuff, etc.

That was a mistake I now know. Reclaim will remove active unrequested installs. 
But the help/man does not say so.

G

Sent from my iPhone

> On 9 May 2021, at 21:26, Daniel J. Luke  wrote:
> 
> On May 9, 2021, at 12:20 PM, Gerben Wierda via macports-users 
>  wrote:
>> Anyway, the hard lesson was: reclaim is not ’safe’. I  thought, reclaim 
>> would only remove inactive installs, but it removed active ones as well.
>> 
>> It is not possible for me to retrace what went wrong exactly, sadly.
> 
> The first thing reclaim does is this:
> 
> --->  Checking for unnecessary unrequested ports
> Unrequested ports without requested dependents found:
> 
> If you (like me) have an MacPorts install that pre-dates the requested flag, 
> you'll have a bunch of ports in that list that you don't actually want 
> uninstalled. For reclaim to work best, you need to do `port setrequested` on 
> the ports you want to always keep - then the list of ports you see there will 
> be stuff that got installed that you no longer need. (You can also mark 
> things 'unrequested', see the port manpage - so you can fix things up if you 
> mistakenly mark something requested that you don't want).
> 
> Or, you can just hit 'n' for the first prompt.
> 
> -- 
> Daniel J. Luke
> 


Re: Reclaim was not 'safe'

2021-05-09 Thread Daniel J. Luke
On May 9, 2021, at 12:20 PM, Gerben Wierda via macports-users 
 wrote:
> Anyway, the hard lesson was: reclaim is not ’safe’. I  thought, reclaim would 
> only remove inactive installs, but it removed active ones as well.
> 
> It is not possible for me to retrace what went wrong exactly, sadly.

The first thing reclaim does is this:

--->  Checking for unnecessary unrequested ports
Unrequested ports without requested dependents found:

If you (like me) have an MacPorts install that pre-dates the requested flag, 
you'll have a bunch of ports in that list that you don't actually want 
uninstalled. For reclaim to work best, you need to do `port setrequested` on 
the ports you want to always keep - then the list of ports you see there will 
be stuff that got installed that you no longer need. (You can also mark things 
'unrequested', see the port manpage - so you can fix things up if you 
mistakenly mark something requested that you don't want).

Or, you can just hit 'n' for the first prompt.

-- 
Daniel J. Luke