Bugzilla – Bug 1057
[bisected] main: sudo eats newlines on stderr since 760c9c110
Last modified: 2023-11-06 11:20:56 MST
Initially observed the problem after `nixpkgs` update sudo to 1.9.14p3 with a backport of https://github.com/sudo-project/sudo/commit/760c9c11074cb921ecc0da9fbb5f0a12afd46233.patch commit: https://github.com/NixOS/nixpkgs/pull/240681 This exposed a recent regression in sudo/main. Reproducer: Good: newlines look as expected: # 1.9.14p3, no patches: $ { sudo printf "a\nb\nc\n" >&2; } |& nl 1 a 2 b 3 c Bad: newlines are like staircase (as if '\r' has no effect): # main, no patches: $ { sudo printf "a\nb\nc\n" >&2; } |& nl 1 a 2 b 3 c Bisect says it started since the following commit: commit 760c9c11074cb921ecc0da9fbb5f0a12afd46233 Date: Wed Jul 26 19:43:49 2023 -0600 Don't assume that if std{in,out,err} is a tty, it is the user's tty. Previously, sudo only checked that the fd was a terminal, not that it matched sudo's idea of the user's terminal. This matters when input or output is redirected to a different terminal. In that case we want to interpose the fd with a pipe even if it refers to a terminal. Bug #1056.
Thanks for the report, this is now fixed by: https://www.sudo.ws/repos/sudo/rev/ac80d75699d1 Please let the nixpkgs folks know so they can update their patch.
(In reply to Todd C. Miller from comment #1) > Thanks for the report, this is now fixed by: > https://www.sudo.ws/repos/sudo/rev/ac80d75699d1 > > Please let the nixpkgs folks know so they can update their patch. The fix works for me as well. Proposed backport downstream as https://github.com/NixOS/nixpkgs/pull/248742 Thank you!
Closing now that sudo 1.9.15 is available.