[Pkg-zsh-devel] Bug#990270: zsh: incorrect handling of EBADF for builtins

Vincent Lefevre vincent at vinc17.net
Thu Jun 24 11:22:06 BST 2021


Package: zsh
Version: 5.8-6+b1
Severity: normal
Tags: upstream
Forwarded: https://www.zsh.org/mla/workers/2021/msg01265.html

zsh does not always handle output error correctly, e.g. with
closed stdout (yielding EBADF). For instance:

zira% (exec >&-; echo; echo $? >&2)
zsh: write error: bad file descriptor
0
zira% (exec >&-; echo >&-; echo $? >&2)
0
zira% (exec >&-; print; echo $? >&2)
zsh: write error: bad file descriptor
0
zira% (exec >&-; print >&-; echo $? >&2)
0
zira% (exec >&-; pwd; echo $? >&2)
zsh: write error: bad file descriptor
0
zira% (exec >&-; pwd >&-; echo $? >&2)
0
zira% (exec >&-; history; echo $? >&2)
zsh: write error: bad file descriptor
0
zira% (exec >&-; history >&-; echo $? >&2)
0

There are 2 issues:

1. The exit status is always 0 instead of non-zero.

2. The error message is missing when stdout is closed in the same
command.

According to

  https://www.zsh.org/mla/workers/2021/msg01267.html

EBADF is treated specially, at least for echo. See

  https://www.zsh.org/mla/workers/2021/msg01335.html

about the history.

-- Package-specific info:

Packages which provide vendor completions:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version      Architecture Description
+++-================-============-============-=======================================================================
ii  curl             7.74.0-1.2   amd64        command line tool for transferring data with URL syntax
ii  mercurial-common 5.6.1-4      all          easy-to-use, scalable distributed version control system (common files)
ii  meson            0.56.2-1     all          high-productivity build system
ii  ninja-build      1.10.1-1     amd64        small build system closest in spirit to Make
ii  pass             1.7.4-1      all          lightweight directory-based password manager
ii  pulseaudio       14.2-2       amd64        PulseAudio sound server
ii  qpdf             10.1.0-1     amd64        tools for transforming and inspecting PDF files
ii  systemd          247.3-5      amd64        system and service manager
ii  udev             247.3-5      amd64        /dev/ and hotplug management daemon
ii  vlc-bin          3.0.16-1     amd64        binaries from VLC
ii  youtube-dl       2021.02.10-2 all          downloader of videos from YouTube and other sites

The following files were modified:

/etc/systemd/logind.conf
/etc/systemd/journald.conf
/etc/systemd/system.conf

dpkg-query: no path found matching pattern /usr/share/zsh/vendor-functions/


-- System Information:
Debian Release: 11.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-security'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-7-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages zsh depends on:
ii  libc6       2.31-12
ii  libcap2     1:2.44-1
ii  libtinfo6   6.2+20201114-2
ii  zsh-common  5.8-6

Versions of packages zsh recommends:
ii  libgdbm6      1.19-2
ii  libncursesw6  6.2+20201114-2
ii  libpcre3      2:8.39-13

Versions of packages zsh suggests:
ii  zsh-doc  5.8-6

-- no debconf information

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



More information about the Pkg-zsh-devel mailing list