On Thu, 2025-07-10 at 17:06 -0500, 'Nathaniel Hourt' via bup-list wrote:
>
> Sadly, reproducing the problem in a minimal environment did not
> immediately point me at the answer. Hahaha
Well adding strace and running made it simple to figure out ... I don't
know what's special about this cut/head combination, but basically 'cut'
dies because it gets SIGPIPE, because 'head' exits after reading the
first line.
From the cut strace:
read(0, "09f8c6c0d5ad2df6fda3240aab881f2e"..., 1024) = 47
ioctl(1, TIOCGWINSZ, 0x7fff71fd0238) = -1 ENOTTY (Not a tty)
writev(1, [{iov_base="09f8c6c0d5ad2df6fda3240aab881f2e"..., iov_len=40}, {iov_base="\n", iov_len=1}], 2) = 41
read(0, "d00491fd7e5bb6fa28c517a0bb32b8b5"..., 1024) = 129
read(0, "", 1024) = 0
close(0) = 0
writev(1, [{iov_base="d00491fd7e5bb6fa28c517a0bb32b8b5"..., iov_len=123}, {iov_base=NULL, iov_len=0}], 2) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=3293, si_uid=1000} ---
+++ killed by SIGPIPE +++
You can play with something like
(for i in $(seq 1000) ; do echo asdfasdfasdfasdf ; done) | strace cut -b -1 | head -1
to reproduce it - and vary the '1000' number there.
In your container, we get the SIGPIPE with 2 instead of 1000. On my F42
system, I only get the SIGPIPE starting at a bit over 2000. Could be
something with the input buffer size, perhaps, on my system both cut and
head use 8k, but on your container they use 1k, though both are GNU
coreutils? Scheduling shouldn't be different between the container on my
system and my system itself, I'd think?
So mystery solved, but I really have no idea how to work around it for
the tests. We don't really want to interpose "WVPASS sponge /dev/stdout"
everywhere we use "head -1", I guess ... hrm.
johannes