Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: sysexits.h codes? (was: Re: [RFC][PATCH] `newuser` prompt theme)



Marlon Richert wrote on Mon, May 03, 2021 at 14:36:01 +0300:
> On Sat, May 1, 2021 at 5:43 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Marlon Richert wrote on Sat, May 01, 2021 at 16:39:06 +0300:
> > > > Yeah.  The code should say what it was trying to do when it called the
> > > > syscall which returned that error; i.e., «zerrnam(foo, "while doing bar:
> > > > %e", errno)» rather than «zerrnam(foo, "%e", errno)».
> > >
> > > That still wouldn't help the user understand why this happens (because
> > > NOCLOBBER is set)
> >
> > NO_CLOBBER being set could be an action at a distance, so it'd be
> > reasonable for stderr to mention it.  Feel free to propose new text.
> 
> Is there any precedent for warnings/errors that mention a shell option
> being (un)set? If so, then we could use that as a template for this
> one.

None comes to mind, and grepping the output of `strings =zsh` doesn't
turn up any, either.

> Otherwise, maybe something like this?
> 
> zsh: NO_CLOBBER: file exists; use >| to override
> 
> It would give you the right keywords to use in a web search.

+1 on putting the option name first.

Not sure whether putting the strerror(3) string in the middle would
work well in all cases.  Convention — codified in errx(3) and friends,
and compare Perl's «die "foo"» without a trailing newline — is that
extra information is appended, rather than surrounded.  The latter could
also lead to ambiguous or unclear grammatical structures.

Furthermore, the extra advice in the error wouldn't always be
appropriate — for instance, when the error is EACCES ("Permission
denied").

> > > As for your other points: Your call. I've laid out my arguments; I
> > > have nothing further to add.
> >
> > What, are you asking me to make all design decisions myself?  That's not
> > how this list works.
> 
> Sorry, I don't feel strongly enough about this to feel like debating it. :)

Well, suit yourself, but unless someone else shows up to drive the
discussion, it'll likely be left at that.




Messages sorted by: Reverse Date, Date, Thread, Author