public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE.
@ 2022-08-08 17:32 carlos at redhat dot com
  2022-08-08 17:33 ` [Bug stdio/29459] " carlos at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: carlos at redhat dot com @ 2022-08-08 17:32 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29459

            Bug ID: 29459
           Summary: fwrite does not return EPIPE when underlying write
                    fails with EPIPE.
           Product: glibc
           Version: 2.36
            Status: NEW
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: carlos at redhat dot com
  Target Milestone: ---

This was reported downstream for CentOS 9 Stream here:
https://bugzilla.redhat.com/show_bug.cgi?id=2112672

The issue is an upstream issue that needs review.

The test case is attached from the downstream issue.

An strace shows the issue clearly:

1659979752.806415 write(1, "hello\n", 6) = 6
1659979752.806467 write(2, "1. fwrite wrote 6 bytes and ferror is 0\n", 40) =
40
1659979752.806517 write(1, "hello\n", 6) = -1 EPIPE (Broken pipe)
1659979752.806548 --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER,
si_pid=202616, si_uid=1000} ---
1659979752.806563 write(2, "2. fwrite wrote 6 bytes and ferror is 1\n", 40) =
40

The underlying write fails with EPIPE, but fwrite doesn't itself fail.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug stdio/29459] fwrite does not return EPIPE when underlying write fails with EPIPE.
  2022-08-08 17:32 [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE carlos at redhat dot com
@ 2022-08-08 17:33 ` carlos at redhat dot com
  2022-08-08 17:33 ` carlos at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: carlos at redhat dot com @ 2022-08-08 17:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29459

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=2112672

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug stdio/29459] fwrite does not return EPIPE when underlying write fails with EPIPE.
  2022-08-08 17:32 [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE carlos at redhat dot com
  2022-08-08 17:33 ` [Bug stdio/29459] " carlos at redhat dot com
@ 2022-08-08 17:33 ` carlos at redhat dot com
  2022-08-08 17:35 ` carlos at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: carlos at redhat dot com @ 2022-08-08 17:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29459

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
Created attachment 14264
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14264&action=edit
test-fwrite.c

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug stdio/29459] fwrite does not return EPIPE when underlying write fails with EPIPE.
  2022-08-08 17:32 [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE carlos at redhat dot com
  2022-08-08 17:33 ` [Bug stdio/29459] " carlos at redhat dot com
  2022-08-08 17:33 ` carlos at redhat dot com
@ 2022-08-08 17:35 ` carlos at redhat dot com
  2022-08-08 17:50 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: carlos at redhat dot com @ 2022-08-08 17:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29459

--- Comment #2 from Carlos O'Donell <carlos at redhat dot com> ---
POSIX says it shall fail with EPIPE:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fputc.html#
"An attempt is made to write to a pipe or FIFO that is not open for reading by
any process. A SIGPIPE signal shall also be sent to the thread."

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug stdio/29459] fwrite does not return EPIPE when underlying write fails with EPIPE.
  2022-08-08 17:32 [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE carlos at redhat dot com
                   ` (2 preceding siblings ...)
  2022-08-08 17:35 ` carlos at redhat dot com
@ 2022-08-08 17:50 ` schwab@linux-m68k.org
  2022-08-08 19:19 ` carlos at redhat dot com
  2022-08-08 19:57 ` sam at gentoo dot org
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2022-08-08 17:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29459

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
How exactly is the test program called?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug stdio/29459] fwrite does not return EPIPE when underlying write fails with EPIPE.
  2022-08-08 17:32 [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE carlos at redhat dot com
                   ` (3 preceding siblings ...)
  2022-08-08 17:50 ` schwab@linux-m68k.org
@ 2022-08-08 19:19 ` carlos at redhat dot com
  2022-08-08 19:57 ` sam at gentoo dot org
  5 siblings, 0 replies; 7+ messages in thread
From: carlos at redhat dot com @ 2022-08-08 19:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29459

--- Comment #4 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Andreas Schwab from comment #3)
> How exactly is the test program called?

./fwrite -l hello 5000 | head -n1

Such that head terminates and closes the pipe after reading one line.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug stdio/29459] fwrite does not return EPIPE when underlying write fails with EPIPE.
  2022-08-08 17:32 [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE carlos at redhat dot com
                   ` (4 preceding siblings ...)
  2022-08-08 19:19 ` carlos at redhat dot com
@ 2022-08-08 19:57 ` sam at gentoo dot org
  5 siblings, 0 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2022-08-08 19:57 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29459

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-08 19:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 17:32 [Bug stdio/29459] New: fwrite does not return EPIPE when underlying write fails with EPIPE carlos at redhat dot com
2022-08-08 17:33 ` [Bug stdio/29459] " carlos at redhat dot com
2022-08-08 17:33 ` carlos at redhat dot com
2022-08-08 17:35 ` carlos at redhat dot com
2022-08-08 17:50 ` schwab@linux-m68k.org
2022-08-08 19:19 ` carlos at redhat dot com
2022-08-08 19:57 ` sam at gentoo dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).