public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/6771] New: %m specifier in dprintf doesn't work as errno clobbered before output
@ 2008-07-26 20:47 l at lwithers dot me dot uk
  2008-07-26 20:50 ` [Bug libc/6771] " l at lwithers dot me dot uk
  2008-07-26 23:43 ` drepper at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: l at lwithers dot me dot uk @ 2008-07-26 20:47 UTC (permalink / raw)
  To: glibc-bugs

Using the "%m" (error string) specifier in dprintf() does not work when the 
file descriptor is non-seekable. lseek() is called on the file descriptor and 
sets errno to ESPIPE. Then it appears the actual formatting and outputting is 
done. This causes the %m in the output to always report "Illegal seek".

I attach a simple test program which illustrates the problem.

An excerpt of the strace output from this program illuminates the problem:

unlink("nonexistent")                   = -1 ENOENT (No such file or directory)
fstat(2, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 10), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f8edefb8000
lseek(2, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(2, "Error: Illegal seek\n", 20)   = 20

The expected behaviour would be for the original value of errno to be restarted 
after the lseek(), so that %m would output (in this case) "No such file or 
directory".

I am using what Gentoo refer to as "2.8_p20080602".

-- 
           Summary: %m specifier in dprintf doesn't work as errno clobbered
                    before output
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: l at lwithers dot me dot uk
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6771

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/6771] %m specifier in dprintf doesn't work as errno clobbered before output
  2008-07-26 20:47 [Bug libc/6771] New: %m specifier in dprintf doesn't work as errno clobbered before output l at lwithers dot me dot uk
@ 2008-07-26 20:50 ` l at lwithers dot me dot uk
  2008-07-26 23:43 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: l at lwithers dot me dot uk @ 2008-07-26 20:50 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From l at lwithers dot me dot uk  2008-07-26 20:49 -------
Created an attachment (id=2840)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2840&action=view)
Test program to reproduce the bug


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6771

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/6771] %m specifier in dprintf doesn't work as errno clobbered before output
  2008-07-26 20:47 [Bug libc/6771] New: %m specifier in dprintf doesn't work as errno clobbered before output l at lwithers dot me dot uk
  2008-07-26 20:50 ` [Bug libc/6771] " l at lwithers dot me dot uk
@ 2008-07-26 23:43 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2008-07-26 23:43 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2008-07-26 23:42 -------
Fixed in cvs.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=6771

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2008-07-26 23:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-26 20:47 [Bug libc/6771] New: %m specifier in dprintf doesn't work as errno clobbered before output l at lwithers dot me dot uk
2008-07-26 20:50 ` [Bug libc/6771] " l at lwithers dot me dot uk
2008-07-26 23:43 ` drepper at redhat dot com

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).