zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: xtrace output sets ERRNO to 9 (EBADF)
Date: Fri, 9 Dec 2022 14:10:47 +0000	[thread overview]
Message-ID: <20221209141047.oyv3jsdvo5s3z6m6@chazelas.org> (raw)

$ ./Src/zsh -c 'set -o xtrace; ERRNO=0; :; echo "$ERRNO"'
+zsh:1> ERRNO=0
+zsh:1> :
+zsh:1> echo 9
9

Seems to be caused by a double-close. From strace:

dup(2)                                  = 3
fcntl(3, F_DUPFD, 10)                   = 12
close(3)                                = 0
fcntl(12, F_GETFL)                      = 0x1 (flags O_WRONLY)
newfstatat(12, "", {st_mode=S_IFIFO|0600, st_size=0, ...}, AT_EMPTY_PATH) = 0
brk(0x557861189000)                     = 0x557861189000
write(12, "+zsh:1> :\n", 10+zsh:1> :
)            = 10
close(12)                               = 0
brk(0x557861188000)                     = 0x557861188000
close(12)                               = -1 EBADF (Bad file descriptor)

(on Debian GNU/Linux amd64 with 5.9 or git HEAD).

-- 
Stephane


             reply	other threads:[~2022-12-09 14:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 14:10 Stephane Chazelas [this message]
2022-12-10  2:57 ` Bart Schaefer
2022-12-10 11:38   ` Daniel Shahaf
2022-12-11 18:35     ` Stephane Chazelas
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=20221209141047.oyv3jsdvo5s3z6m6@chazelas.org \
    --to=stephane@chazelas.org \
    --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).