On Tue, Oct 11, 2022 at 01:32:43PM +0200, Janne Johansson wrote:
> > On Mon, Oct 10, 2022 at 11:17:32AM -0600, Theo de Raadt wrote:
> > > It's been explained a few times that being up-to-date is not an error.
> > > It's a good thing, and no action is neccessary when up-to-date.
> > > Any non-zero value indicates an error, that would include 2.  You are
> > > marking this as an error, when it isn't.
> >
> > It's been said that being up-to-date is not an error, but if it's been
> > explained, I've failed to find an explanation.
> >
> > Usually, when a utility fails to perform its intended task, it gives an
> > error.
> > I don't personally care what exit code it throws, I only use the tool
> > manually, I'd just like to know the rationale if anyone cares to
> > elaborate.
> 
> Simplest explanation is probably:
> 
> ./some-program && do something on success
> 
> If you understand this part of shell scripting, then you would see why 
> returning
> 2 (or 1 or 3 or 102444) will throw off the logic, especially if 1
> means some kind
> of error.
> 
> As for "intended task", sysupgrade might be viewed as a tool to make
> sure you have
> the latest it knows about. If no upgrade is needed or the mirror is
> old, then that task is done.
> 
> Someone else might think it is a tool to stress the network and disk
> by always downloading
> things from the internet, and that it is a grave error if this can't
> be done, but those people
> would have a view that differs from the obsd devs idea of what to use
> sysupgrade for.
> 
> Also, if you replace your "mkdir /foo with missing /foo" with "install
> -d /foo", you'd see it can
> run twice without throwing errors. It makes sure a dir named foo is
> created if not exists.
> That is its task when run with -d. And you can && a command behind it
> so it catches errors
> if a file/pipe/socket is there instead. Or add -p to mkdir to get the
> same behaviour.
> 
> -- 
> May the most significant bit of your life be positive.

Aha. I didn't know install worked that way (though mkdir -p does too,
now that I think of it). I guess my actual confusion was perhaps due to
this behavior being implied whereas other utilities are rather explicit
about it, at least in terms of man files.

Thanks!

Reply via email to