coreutils
coreutils copied to clipboard
dd fails with 'IO error: Broken pipe' when input source is STDIN
Hey, so this test case isn't something I have much control over, as I'm duplicating an error I'm seeing, while installing VSCode:
cat vscode-server-linux-x64.tar.gz | (/nix/store/s7yw4jhigzbw5qy3n6s5w40jg99f2ar9-uutils-coreutils-0.0.25/bin/dd iflag=fullblock bs=8192 count=7265 status=progress; /nix/store/s7yw4jhigzbw5qy3n6s5w40jg99f2ar9-uutils-coreutils-0.0.25/bin/dd iflag=fullblock bs=7339 count=1 status=progress) | tar --no-same-owner -xz -C unpack
gzip: stdin: invalid compressed data--format violated
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
/nix/store/s7yw4jhigzbw5qy3n6s5w40jg99f2ar9-uutils-coreutils-0.0.25/bin/dd: IO error: Broken pipe
/nix/store/s7yw4jhigzbw5qy3n6s5w40jg99f2ar9-uutils-coreutils-0.0.25/bin/dd: IO error: Broken pipe
You'll note that this is the uutils-coreutils, as distributed by NixOS. I am able to compare this result to the result of running the same command, using coreutils-9.4:
which dd
/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin/dd
rust-dev$ cat vscode-server-linux-x64.tar.gz | (dd iflag=fullblock bs=8192 count=7265 status=progress; dd iflag=fullblock bs=7339 count=1 status=progress) | tar --no-same-owner -xz -C unpack
7265+0 records in
7265+0 records out
59514880 bytes (60 MB, 57 MiB) copied, 0.912032 s, 65.3 MB/s
1+0 records in
1+0 records out
7339 bytes (7.3 kB, 7.2 KiB) copied, 2.1481e-05 s, 342 MB/s
As much as possible, these commands are identical, apart from running different variants of dd. I did some investigating with strace and made a few screen captures. Happy to provide those, or even the strace logs, if that is helpful, but they're kind of large. From what I can tell, the pipe is emptied, possibly by the first dd command, but then it never finishes writing contents before dying.
Here is a link that will pull the test file I'm using, which should make re-producing this easier: vscode-server
dd version reports it is 0.0.25.