public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12782] New: POSIX strerror_r quality of implementation
@ 2011-05-18 23:33 eblake at redhat dot com
  2011-05-18 23:34 ` [Bug libc/12782] " eblake at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: eblake at redhat dot com @ 2011-05-18 23:33 UTC (permalink / raw)
  To: glibc-bugs

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

           Summary: POSIX strerror_r quality of implementation
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: eblake@redhat.com


Although POSIX permits 'buf' to remain untouched on error, it does not require
this; in fact, it recommends that buf still be populated insofar as possible
for a better quality of implementation (since applications are likely to use
the contents of buffer without checking for errors).  Furthermore, this is more
in line with what glibc does for GNU strerror_r (a useful result at all costs,
even if the result had to be truncated):

XSH line 63300:

"Similarly, implementations are encouraged to have strerror_r( ) return
[EINVAL] and put a string like "unknown error" or "error number xxx" in the
buffer pointed to by strerrbuf when the value of errnum is not a valid error
number."

and http://austingroupbugs.net/view.php?id=398:

"Additionally, implementations are encouraged to NUL-terminate strerrbuf
when failing with ERANGE for any size other than buflen of zero."

If you use the example program of
http://sourceware.org/bugzilla/show_bug.cgi?id=12204, then I argue that the
results on glibc should be:

result: failure 22 Unknown error 18446744073709551614
result: failure 34 Pe

rather than Bruno's claim of

result: failure 22 ______
result: failure 34 ______

Additionally, that bug showed prior art of other platforms that (almost) have
this QoI issue resolved according to POSIX recommendations:

FreeBSD 6.4 (albeit buggy for returning EINVAL on 0), AIX 6.1 (albeit buggy for
not returning ERANGE on short buffer), Tru64 5.1 (albeit buggy for wrong return
values).

-- 
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] 7+ messages in thread

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18 23:33 [Bug libc/12782] New: POSIX strerror_r quality of implementation eblake at redhat dot com
2011-05-18 23:34 ` [Bug libc/12782] " eblake at redhat dot com
2011-05-18 23:36 ` eblake at redhat dot com
2011-05-21 16:13 ` drepper.fsp at gmail dot com
2011-05-21 17:21 ` bruno at clisp dot org
2012-06-30 16:12 ` bruno at clisp dot org
2014-06-27 13:20 ` 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).