Re: Fwd: Behavior change in Dash pipes/read?

Herbert Xu <[email protected]> Sun, 1 Mar 2026 10:45:35 +0900
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
On Sat, Feb 07, 2026 at 09:03:16PM +0200, Jyri-Matti Lähteenmäki wrote:
> Hi,
> 
> already tried that but it didn't work. I'm guessing strace-macos
> doesn't pass stdin to the spawned process.
> Figured I could try attach-to-process approach, are these of any help?

Thanks this is quite illuminating.
 
> echo hello | /nix/store/kra243nir1p3pyc50312w3nmirbcbxr0-dash-0.5.13.1/bin/dash
> ./test.sh
> 8931
> > strace -p 8931
> sigprocmask(SIG_BLOCK, 0x0, "[]") = 0
> sigprocmask(SIG_BLOCK, 0x0, "[]") = 0
> ioctl(0, TIOCGETA, 0x100498498) = -1 EPERM (Operation not permitted)
> lseek(0, 0, SEEK_CUR) = -1 EPERM (Operation not permitted)
> pipe() = 0
> fcntl(3, F_DUPFD_CLOEXEC, 10) = 11
> close(3) = 0
> fcntl(4, F_DUPFD_CLOEXEC, 10) = 12
> close(4) = 0

This shows that the new tee(2) path was entered and then bailed
out because tee(2) is not available.

> read(0, "h", 1) = 1
> read(0, "e", 1) = 1
> read(0, "l", 1) = 1
> read(0, "l", 1) = 1
> read(0, "o", 1) = 1
> read(0, "\n", 1) = 1
> read(0, "\n", 1) = 0

This still doesn't make sense though.  For some reason read(1)
didn't stop on the first newline and just kept going until EOF,
but at least it explains the empty output after the read.

Could you please try building and running the commit just before
tee(2) was introduced?

commit b1864ee9f2418f84d918ef101dab972ecf4f852f
Author: Herbert Xu <[email protected]>
Date:   Sun Jun 2 09:31:35 2024 +0800

    input: Use lseek on stdin when possible

Thanks,
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt