[Pkg-zsh-devel] Bug#990985: zsh: SIGPIPE trap not executed when the builtin that generates it is the last command

Vincent Lefevre vincent at vinc17.net
Mon Jul 12 10:26:59 BST 2021


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

With zsh 5.8, the SIGPIPE trap is not executed when the builtin that
generates it is the last command of a subshell:

zira% ( trap 'echo PIPE >&2' PIPE; sleep 1; pwd; ) | :
zsh: write error: broken pipe

With an additional command (builtin), this is OK:

zira% ( trap 'echo PIPE >&2' PIPE; sleep 1; pwd; :; ) | :
zsh: write error: broken pipe
PIPE

I wonder whether this is related to the (undocumented?) optimization
that exec's the last command of a subshell / shell script (though
this is not applicable to builtins).

This also occurs with zsh 5.7.1-1 in Debian 10 (buster).

There is the same issue with mksh, but not with dash, ksh93, bash and
yash.

-- 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.3+b1 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  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

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)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/12 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-13
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