FS#67901 - [zsh] sudo with pacman fails with pipe

Attached to Project: Arch Linux
Opened by Ronan Pigott (Brocellous) - Monday, 14 September 2020, 22:26 GMT
Last edited by David Thurstenson (thurstylark) - Monday, 25 April 2022, 20:09 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The bug I'm describing has been in zsh for a while and causes errors like this:

pacman -Qtdq | sudo pacman -Rns -
:: Do you want to remove these packages? [Y/n] zsh: done
pacman -Qtdq |
zsh: suspended (tty output) sudo pacman -Rns -

The command at the front of the pipe does not matter. The flags used in the sudo pacman do not matter. The only important thing is if sudo has cached authentication for the current user, in which case the password prompt will be skipped, the "zsh: suspended" response is given, and the user cannot continue the requested pacman operation.

I wrote the zsh mailing list about this bug earlier this year. You can find my original mail and the subsequent discussion at [1]. It resulted in this patch [2] for zsh that fixes the issue.

I've run this patch for a while but sometimes I use other machines where I forget about this annoying bug. Basically, I want to request that [2] be backported to Arch's zsh package because I think it disproportionately affects pacman users by interrupting many of pacman's regular operations. Save for the ChangeLog message (because it would be out of order), it apples cleanly to 5.8. e.g you can get a clean patch with: `git show 14ea665a -- ':!ChangeLog' > fix-pacman-sudo.patch`.

[1] https://www.zsh.org/mla/users/2020/msg00119.html
[2] https://github.com/zsh-users/zsh/commit/14ea665a903b26a658ef1d2ca974a9b48e09eff1
This task depends upon

Closed by  David Thurstenson (thurstylark)
Monday, 25 April 2022, 20:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  zsh 5.8.1-2
Comment by Ronan Pigott (Brocellous) - Friday, 03 September 2021, 00:00 GMT
Interestingly I can no longer reproduce this with zsh 5.8-1 from extra.

The simple reproducer from the mailing list now hangs awkwardly, but no longer indicates the process is suspended.

No idea what has changed, but I would be interested to find out. The zsh package has not changed so I can only assume the change is in sudo.