zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-workers@zsh.org
Subject: Re: xtrace output sets ERRNO to 9 (EBADF)
Date: Sun, 11 Dec 2022 18:35:46 +0000	[thread overview]
Message-ID: <20221211183546.ogwicuctgxbtit6w@chazelas.org> (raw)
In-Reply-To: <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


  reply	other threads:[~2022-12-11 18:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 14:10 Stephane Chazelas
2022-12-10  2:57 ` Bart Schaefer
2022-12-10 11:38   ` Daniel Shahaf
2022-12-11 18:35     ` Stephane Chazelas [this message]
2022-12-11 18:52       ` Bart Schaefer
2022-12-11 20:01         ` Stephane Chazelas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221211183546.ogwicuctgxbtit6w@chazelas.org \
    --to=stephane@chazelas.org \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).