public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12805] New: GNU strerror_r should always populate buf
@ 2011-05-25 15:07 eblake at redhat dot com
  2011-05-25 15:16 ` [Bug libc/12805] " eblake at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: eblake at redhat dot com @ 2011-05-25 15:07 UTC (permalink / raw)
  To: glibc-bugs

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

           Summary: GNU strerror_r should always populate buf
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: eblake@redhat.com


Right now, it is impossible to write a program that works using either the GNU
or the XPG strerror_r signature.  That is because the GNU strerror_r does not
always populate buf, but expects the caller to use the returned pointer (the
returned pointer is equal to buf in the case where an "Unknown error nnn"
string was computed, but is distinct in the case where an untruncated known
error string was returned).  Of course, the contents put into buf might be
subject to truncation even though the distinct return pointer contains the
untruncated message, but an application can avoid that by using a large enough
buffer.

http://sourceware.org/bugzilla/show_bug.cgi?id=12782 just fixed XPG strerror_r
to always populate buf.  And by changing GNU strerror_r to likewise always
populate as much of buf as possible, you then make it possible for an
application to call strerror_r with a sufficiently large buffer size (hopefully
256 bytes is larger than any translation for any known error string), ignore
the return value, and thus use _either variant_ of strerror_r without regards
to the difference in return types, because buf will be usable as the resulting
message in both cases.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12805] GNU strerror_r should always populate buf
  2011-05-25 15:07 [Bug libc/12805] New: GNU strerror_r should always populate buf eblake at redhat dot com
@ 2011-05-25 15:16 ` eblake at redhat dot com
  2011-05-25 19:12 ` drepper.fsp at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: eblake at redhat dot com @ 2011-05-25 15:16 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Eric Blake <eblake at redhat dot com> 2011-05-25 15:16:19 UTC ---
Created attachment 5750
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5750
proposed patch

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12805] GNU strerror_r should always populate buf
  2011-05-25 15:07 [Bug libc/12805] New: GNU strerror_r should always populate buf eblake at redhat dot com
  2011-05-25 15:16 ` [Bug libc/12805] " eblake at redhat dot com
@ 2011-05-25 19:12 ` drepper.fsp at gmail dot com
  2011-06-11  3:27 ` bugdal at aerifal dot cx
  2014-06-27 13:17 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: drepper.fsp at gmail dot com @ 2011-05-25 19:12 UTC (permalink / raw)
  To: glibc-bugs

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

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

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

--- Comment #2 from Ulrich Drepper <drepper.fsp at gmail dot com> 2011-05-25 19:12:02 UTC ---
Bollocks.  The interface allows to be efficient and this won't be sacrifized
because some people cannot \understand the spec.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12805] GNU strerror_r should always populate buf
  2011-05-25 15:07 [Bug libc/12805] New: GNU strerror_r should always populate buf eblake at redhat dot com
  2011-05-25 15:16 ` [Bug libc/12805] " eblake at redhat dot com
  2011-05-25 19:12 ` drepper.fsp at gmail dot com
@ 2011-06-11  3:27 ` bugdal at aerifal dot cx
  2014-06-27 13:17 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: bugdal at aerifal dot cx @ 2011-06-11  3:27 UTC (permalink / raw)
  To: glibc-bugs

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

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #3 from Rich Felker <bugdal at aerifal dot cx> 2011-06-11 03:26:22 UTC ---
The incompatible versions of strerror_r and their ugly behavior of requiring a
caller-provided buffer for what should be .rodata strings can be avoided
entirely by using the (POSIX 2008) strerror_l function. Thus I tend to agree
there's no sense in trying to fix/improve strerror_r.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12805] GNU strerror_r should always populate buf
  2011-05-25 15:07 [Bug libc/12805] New: GNU strerror_r should always populate buf eblake at redhat dot com
                   ` (2 preceding siblings ...)
  2011-06-11  3:27 ` bugdal at aerifal dot cx
@ 2014-06-27 13:17 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 13:17 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
              Flags|                            |security-

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


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

end of thread, other threads:[~2014-06-27 13:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 15:07 [Bug libc/12805] New: GNU strerror_r should always populate buf eblake at redhat dot com
2011-05-25 15:16 ` [Bug libc/12805] " eblake at redhat dot com
2011-05-25 19:12 ` drepper.fsp at gmail dot com
2011-06-11  3:27 ` bugdal at aerifal dot cx
2014-06-27 13:17 ` fweimer 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).