Re: Fwd: Behavior change in Dash pipes/read?
Jyri-Matti Lähteenmäki <[email protected]> Sat, 7 Feb 2026 21:03:16 +0200
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <CANhYXO9A5Y=TJi-TbEvv3ASPFjPjdd+pEfhmjqeMMXOCEoCpzw@mail.gmail.com> |
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? > cat test.sh echo $$ sleep 10 read -r x echo "$x" > echo hello | /nix/store/4kjsgkcxqfadycyspzfrf9gg5n5bpc27-dash-0.5.12/bin/= dash ./test.sh 8914 > strace -p 8914 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 read(0, "h", 1) =3D 1 read(0, "e", 1) =3D 1 read(0, "l", 1) =3D 1 read(0, "l", 1) =3D 1 read(0, "o", 1) =3D 1 read(0, "\n", 1) =3D 1 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 write(1, "hello\n", 6) =3D 6 read(10, "echo $$\nsleep 10\nread -r x\necho ...", 1024) =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 echo hello | /nix/store/kra243nir1p3pyc50312w3nmirbcbxr0-dash-0.5.13.1/bin/= dash ./test.sh 8931 > strace -p 8931 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 ioctl(0, TIOCGETA, 0x100498498) =3D -1 EPERM (Operation not permitted) lseek(0, 0, SEEK_CUR) =3D -1 EPERM (Operation not permitted) pipe() =3D 0 fcntl(3, F_DUPFD_CLOEXEC, 10) =3D 11 close(3) =3D 0 fcntl(4, F_DUPFD_CLOEXEC, 10) =3D 12 close(4) =3D 0 read(0, "h", 1) =3D 1 read(0, "e", 1) =3D 1 read(0, "l", 1) =3D 1 read(0, "l", 1) =3D 1 read(0, "o", 1) =3D 1 read(0, "\n", 1) =3D 1 read(0, "\n", 1) =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 write(1, "\n", 1) =3D 1 read(10, "\nread -r x\necho \"$x\"\n\0\0\0\0\0\0\0\0\0\0\0...", 1024) =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 sigprocmask(SIG_BLOCK, 0x0, "[]") =3D 0 --- Jyri-Matti L=C3=A4hteenm=C3=A4ki ke 4.2.2026 klo 11.16 Herbert Xu ([email protected]) kirjoitti: > > Jyri-Matti L=C3=A4hteenm=C3=A4ki <[email protected]> wrote: > > > > The results are as attachments. But > > https://github.com/Mic92/strace-macos says it doesn't follow forks, so > > I guess the interesting parts are missing? > > Running /nix/store/wy9ass74g4yc1x354ydbdlxkfkxxjv2x-dash-0.5.13.1/bin/d= ash > > -c 'echo hello > hello; { read -r x; echo "$x"; } < hello' seems to > > work correctly. > > OK try running strace inside the script: > > echo hello | strace /path/to/dash -c 'read -r x; echo "$x"' > > Thanks, > -- > Email: Herbert Xu <[email protected]> > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt