Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: xtrace output sets ERRNO to 9 (EBADF)
- X-seq: zsh-workers 51187
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: xtrace output sets ERRNO to 9 (EBADF)
- Date: Sun, 11 Dec 2022 18:35:46 +0000
- Archived-at: <https://zsh.org/workers/51187>
- In-reply-to: <20221210113813.GX27622@tarpaulin.shahaf.local2>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- References: <20221209141047.oyv3jsdvo5s3z6m6@chazelas.org> <CAH+w=7bpxyzFYM-sst2D5CYWHHh5R6oggfPH5n5Pcxyq=9ShmQ@mail.gmail.com> <20221210113813.GX27622@tarpaulin.shahaf.local2>
2022-12-10 11:38:13 +0000, Daniel Shahaf:
> Bart Schaefer wrote on Fri, Dec 09, 2022 at 18:57:37 -0800:
> > diff --git a/Src/exec.c b/Src/exec.c
> > index 1810fca5e..a1059af5e 100644
> > --- a/Src/exec.c
> > +++ b/Src/exec.c
> > @@ -4336,10 +4336,13 @@ execcmd_exec(Estate state, Execcmd_params eparams,
> > }
> > }
> > if (newxtrerr) {
> > + int eno = errno;
> > fil = fileno(newxtrerr);
> > fclose(newxtrerr);
> > xtrerr = oxtrerr;
> > + /* Call zclose() to clean up internal tables, ignore EBADF */
> > zclose(fil);
> > + errno = eno;
>
> This ignores any errors from the fileno() and fclose() calls as well, though?
[...]
Yes, though it's probably just as well. Users use $ERRNO to
detect errors while doing operations they asked for.
In my case, I was doing:
ERRNO=0
files=(**/someglob(N))
if (( ERRNO )) ...
To check for errors during the glob expansion (wanting to make
sure that it doesn't missing anythin).
And finding that that glob expansion seemingly failed with EBADF
when run under zsh -x.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author