public inbox for dash@vger.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: martijn@inlv.org, dash@vger.kernel.org
Subject: Re: [BUG] reading from FIFO broken
Date: Sat, 6 Jul 2024 11:45:05 +1000	[thread overview]
Message-ID: <Zoihoen16PgPn3tx@gondor.apana.org.au> (raw)
In-Reply-To: <ZoUs+i4iBAOdYmwI@gondor.apana.org.au>

Herbert Xu <herbert@gondor.apana.org.au> wrote:
> Martijn Dekker <martijn@inlv.org> wrote:
>>
>> ...reading from a FIFO is broken, at least on macOS 12.7.5. It seems like the 
>> 'read' command can no longer read anything from a FIFO.
>> 
>> Reproducer:
>> 
>> $ dash -c 'trap "rm fifo" 0; mkfifo fifo;
>>        echo OK >fifo & read r <fifo; echo "${#r}:$r"'
>> 0:
>> 
>> Expected output:
>> 
>> 2:OK
> 
> I can't reproduce this under Linux.  Could you please run it under
> strace for me?

I even tried stubbing out the tee call and replacing it with

	err = -1;

and it still worked with your test case.  This is what I see through
strace on Linux with a stubbed out tee call:

395516 <... close resumed>)             = 0
395516 ioctl(0, TCGETS <unfinished ...>
395517 <... write resumed>)             = 3
395516 <... ioctl resumed>, 0x7ffcf5136a50) = -1 ENOTTY (Inappropriate ioctl for device)
395517 dup2(10, 1 <unfinished ...>
395516 lseek(0, 0, SEEK_CUR <unfinished ...>
395517 <... dup2 resumed>)              = 1
395516 <... lseek resumed>)             = -1 ESPIPE (Illegal seek)
395517 close(10 <unfinished ...>
395516 pipe2( <unfinished ...>
395517 <... close resumed>)             = 0
395516 <... pipe2 resumed>[3, 4], 0)    = 0
395517 exit_group(0 <unfinished ...>
395516 fcntl(3, F_DUPFD_CLOEXEC, 10 <unfinished ...>
395517 <... exit_group resumed>)        = ?
395516 <... fcntl resumed>)             = 11
395516 close(3)                         = 0
395516 fcntl(4, F_DUPFD_CLOEXEC, 10)    = 12
395517 +++ exited with 0 +++
395516 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=395517, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
395516 rt_sigreturn({mask=[]})          = 12
395516 close(4)                         = 0
395516 read(0, "O", 1)                  = 1
395516 read(0, "K", 1)                  = 1
395516 read(0, "\n", 1)                 = 1
395516 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG, NULL) = 395517
395516 wait4(-1, 0x7ffcf5136b3c, WNOHANG, NULL) = -1 ECHILD (No child processes)
395516 dup2(10, 0)                      = 0
395516 close(10)                        = 0
395516 write(1, "2:OK\n", 5)            = 5
395516 exit_group(0)                    = ?
395516 +++ exited with 0 +++

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2024-07-06  1:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-22 16:53 [BUG] reading from FIFO broken Martijn Dekker
2024-07-03 10:50 ` Herbert Xu
2024-07-06  1:45   ` Herbert Xu [this message]
2024-07-06  1:46     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zoihoen16PgPn3tx@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=dash@vger.kernel.org \
    --cc=martijn@inlv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox