* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
@ 2015-01-12 12:34 ` mac at mcrowe dot com
2015-01-15 11:13 ` schwab@linux-m68k.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mac at mcrowe dot com @ 2015-01-12 12:34 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
Mike Crowe <mac at mcrowe dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|2.21 |2.19
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
2015-01-12 12:34 ` [Bug stdio/17830] " mac at mcrowe dot com
@ 2015-01-15 11:13 ` schwab@linux-m68k.org
2015-01-15 11:22 ` schwab@linux-m68k.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2015-01-15 11:13 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
I think this is a bug in the /dev/kmsg driver. It should return ESPIPE instead
of EBADF.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
2015-01-12 12:34 ` [Bug stdio/17830] " mac at mcrowe dot com
2015-01-15 11:13 ` schwab@linux-m68k.org
@ 2015-01-15 11:22 ` schwab@linux-m68k.org
2015-01-15 15:42 ` mac at mcrowe dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2015-01-15 11:22 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
The problem appears to be that devkmsg_open returns without allocating a
devkmsg_user struct if opened with O_WRONLY, which causes devkmsg_llseek to
return EBADF, even though the file is properly opened. Please report that to
the kernel devs.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
` (2 preceding siblings ...)
2015-01-15 11:22 ` schwab@linux-m68k.org
@ 2015-01-15 15:42 ` mac at mcrowe dot com
2015-01-15 15:57 ` mac at mcrowe dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mac at mcrowe dot com @ 2015-01-15 15:42 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
--- Comment #3 from Mike Crowe <mac at mcrowe dot com> ---
(In reply to Andreas Schwab from comment #2)
> The problem appears to be that devkmsg_open returns without allocating a
> devkmsg_user struct if opened with O_WRONLY, which causes devkmsg_llseek to
> return EBADF, even though the file is properly opened. Please report that
> to the kernel devs.
I think that's intentional. A write-only /dev/kmsg is intended to be
lighter-weight than a readable one.
What seems to be wrong is unconditionally returning EBADF in that situation.
ESPIPE would presumably be better.
Even if the device were opened for reading too and we got past that point I
think dprintf would still get upset since SEEK_CUR isn't handled so
devkmsg_llseek would yield EINVAL.
I think both cases need fixing. I'll try posting a kernel patch.
Thanks for your help.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
` (3 preceding siblings ...)
2015-01-15 15:42 ` mac at mcrowe dot com
@ 2015-01-15 15:57 ` mac at mcrowe dot com
2015-01-15 17:46 ` mac at mcrowe dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mac at mcrowe dot com @ 2015-01-15 15:57 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
--- Comment #4 from Mike Crowe <mac at mcrowe dot com> ---
(In reply to Mike Crowe from comment #3)
> Even if the device were opened for reading too and we got past that point I
> think dprintf would still get upset since SEEK_CUR isn't handled so
> devkmsg_llseek would yield EINVAL.
This case can be reproduced with "./a.out 1<>/dev/kmsg" which yields:
Result: -1 Invalid argument
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
` (4 preceding siblings ...)
2015-01-15 15:57 ` mac at mcrowe dot com
@ 2015-01-15 17:46 ` mac at mcrowe dot com
2015-01-30 4:58 ` bugdal at aerifal dot cx
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mac at mcrowe dot com @ 2015-01-15 17:46 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
--- Comment #5 from Mike Crowe <mac at mcrowe dot com> ---
(In reply to Andreas Schwab from comment #2)
> Please report that to the kernel devs.
http://lkml.iu.edu/hypermail/linux/kernel/1501.1/05813.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
` (5 preceding siblings ...)
2015-01-15 17:46 ` mac at mcrowe dot com
@ 2015-01-30 4:58 ` bugdal at aerifal dot cx
2015-01-30 10:38 ` schwab@linux-m68k.org
2015-01-30 15:19 ` bugdal at aerifal dot cx
8 siblings, 0 replies; 10+ messages in thread
From: bugdal at aerifal dot cx @ 2015-01-30 4:58 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
Rich Felker <bugdal at aerifal dot cx> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugdal at aerifal dot cx
--- Comment #6 from Rich Felker <bugdal at aerifal dot cx> ---
Isn't it something of a bug (performance, if nothing else) that dprintf is
making useless seek attempts on the file descriptor?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
` (6 preceding siblings ...)
2015-01-30 4:58 ` bugdal at aerifal dot cx
@ 2015-01-30 10:38 ` schwab@linux-m68k.org
2015-01-30 15:19 ` bugdal at aerifal dot cx
8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2015-01-30 10:38 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
--- Comment #7 from Andreas Schwab <schwab@linux-m68k.org> ---
Are they useless?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug stdio/17830] dprintf fails when file descriptor is connected to /dev/kmsg
2015-01-12 12:33 [Bug stdio/17830] New: dprintf fails when file descriptor is connected to /dev/kmsg mac at mcrowe dot com
` (7 preceding siblings ...)
2015-01-30 10:38 ` schwab@linux-m68k.org
@ 2015-01-30 15:19 ` bugdal at aerifal dot cx
8 siblings, 0 replies; 10+ messages in thread
From: bugdal at aerifal dot cx @ 2015-01-30 15:19 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=17830
--- Comment #8 from Rich Felker <bugdal at aerifal dot cx> ---
Yes. Presumably the seek is part of setting up the general-case FILE for
glibc's libio stdio ops to know about, but it's completely irrelevant to a
single write-only operation on a temporary FILE structure. dprintf should be
operating more like the virtual FILEs used for snprintf, fmemopen, fopencookie,
etc. rather than using the same ops as fopen so it doesn't pull in all this
overhead to every write.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread