Index | Thread | Search

From:
Marc Espie <marc.espie.openbsd@gmail.com>
Subject:
Re: pkg_add.1: improve clarity for -U
To:
tech@openbsd.org
Date:
Sat, 3 May 2025 12:23:49 +0200

Download raw body.

Thread
On Fri, May 02, 2025 at 12:03:33PM +0100, Stuart Henderson wrote:
> On 2025/05/02 12:21, Peter Hessler wrote:
> > On 2025 May 02 (Fri) at 11:53:19 +0200 (+0200), Kirill A. Korinsky wrote:
> > :On Fri, 02 May 2025 11:28:47 +0200,
> > :Stuart Henderson <stu@spacehopper.org> wrote:
> > :> 
> > :> On 2025/05/01 21:56, Josh Grosse wrote:
> > :> > For consideration.
> > :> 
> > :> > diff --git usr.sbin/pkg_add/pkg_add.1 usr.sbin/pkg_add/pkg_add.1
> > :> > index 67be4b80179..17b3fc12687 100644
> > :> > --- usr.sbin/pkg_add/pkg_add.1
> > :> > +++ usr.sbin/pkg_add/pkg_add.1
> > :> > @@ -109,7 +109,9 @@ with
> > :> >  .Fl u
> > :> >  whenever possible, but
> > :> >  .Fl U
> > :> > -can be much faster.
> > :> > +can be much faster, and is intended for use when running -current, if
> > :> > +a new package needs to be added without conducting a full update of all
> > :> > +packages.
> > :> >  .It
> > :> >  Replace existing packages with explicit other versions, using option
> > :> >  .Fl r .
> > :> 
> > :> -U is a bit of a hack and I think mostly useful for ports developers.
> > :> 
> > :> Diff below gives a better reason *not* to use it.
> > :> 
> > :> Perhaps pkg_add should reject -Uu, afaict it is meaningless, and there
> > :> is some meme which won't go away about running -Uu for updates.
> > :> 
> > :> Bonus -u -> .Fl u fix.
> > :>
> > :
> > :Cleaner wording, indeed!
> > :
> > :Meanwhile, I was able to backtrace the source why so many people uses -U. I
> > :don't belive that all of them read man page and decided to speedup things.
> > :
> > :Long story short: I almost sure that the root cause this page:
> > :https://www.openbsdhandbook.com/upgrade/
> 
> Very possibly, I've run into bad advice from there before. It's almost
> the new c*l*mel. Though -Uu gets repeated a lot on web forums etc, fixing
> that page won't make it all go away.

-uU is actually  harmless !

as you can see in pkg_add's code:
        $state->{hard_replace} = $state->opt('r');
        $state->{newupdates} = $state->opt('u') || $state->opt('U');
        $state->{allow_replacing} = $state->{hard_replace} ||
            $state->{newupdates};
        $state->{pkglist} = $state->opt('l');
        $state->{update} = $state->opt('u');


so -u *also* sets -U. :)


-U saved my ass countless times, running production machines on snapshots,
and discovering at the last minute I've forgotten a critical package
(say mupdf for presentations) and I don't have the time to update the 500+
packages on that machine (including lengthy stuff like texlive)