Anonymous | Login | 2023-06-04 09:59 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0000382 | [1003.1(2008)/Issue 7] System Interfaces | Editorial | Clarification Requested | 2011-02-18 22:24 | 2013-04-16 13:06 | ||
Reporter | jilles | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | ||||||
Name | Jilles Tjoelker | ||||||
Organization | |||||||
User Reference | |||||||
Section | strerror | ||||||
Page Number | 2000 | ||||||
Line Number | 63267 | ||||||
Interp Status | Approved | ||||||
Final Accepted Text | see Note: 0000693 | ||||||
Summary | 0000382: may strerror(0) fail with EINVAL? | ||||||
Description |
Reading XSH 2.3 Error Numbers and the strerror page, it looks like strerror(), strerror_l() and strerror_r() may fail with [EINVAL] if 0 is passed for errnum (for strerror() and strerror_l() at least, a string shall still be returned). Although zero is a possible value for errno and indicates success for pthread_create() and similar functions, it is not an error number. Accordingly, FreeBSD's strerror() and strerror_r() fail with [EINVAL] for errnum==0 (while still returning a string). FreeBSD has received a bug report that this causes POSIX/SUS testsuites to fail: http://www.freebsd.org/cgi/query-pr.cgi?pr=151316 [^] Most other implementations (tested NetBSD, glibc, Solaris) succeed for errnum==0. In any case, I think calling strerror(0) (or equivalent strerror_l()/strerror_r()) is almost always an application bug, violating the recommendation that errno only be examined if indicated to be valid by a function's return value. |
||||||
Desired Action |
One of these three: 1. If I am interpreting something incorrectly and there is language that says strerror(0) must not fail, please point me to it. 2. If strerror(0) is supposed to succeed, change the condition for [EINVAL] from The value of errnum is not a valid error number. to something like The value of errnum is neither a valid error number nor zero. 3. If strerror(0) may fail, clarify this and adjust test suites. |
||||||
Tags | c99, tc1-2008 | ||||||
Attached Files | |||||||
|
![]() |
||||||
|
![]() |
|||
Date Modified | Username | Field | Change |
2011-02-18 22:24 | jilles | New Issue | |
2011-02-18 22:24 | jilles | Status | New => Under Review |
2011-02-18 22:24 | jilles | Assigned To | => ajosey |
2011-02-18 22:25 | jilles | Name | => Jilles Tjoelker |
2011-02-18 22:25 | jilles | Section | => strerror |
2011-02-18 22:25 | jilles | Page Number | => 2000 |
2011-02-18 22:25 | jilles | Line Number | => 63267 |
2011-03-03 17:42 | eblake | Note Added: 0000686 | |
2011-03-03 17:53 | nick | Tag Attached: c99 | |
2011-03-10 17:09 | eblake | Note Added: 0000693 | |
2011-03-10 17:10 | eblake | Tag Attached: tc1-2008 | |
2011-03-10 17:11 | eblake | Interp Status | => Pending |
2011-03-10 17:11 | eblake | Final Accepted Text | => see Note: 0000693 |
2011-03-10 17:11 | eblake | Status | Under Review => Interpretation Required |
2011-03-10 17:11 | eblake | Resolution | Open => Accepted |
2011-03-10 17:12 | eblake | Resolution | Accepted => Accepted As Marked |
2011-03-10 17:14 | eblake | Note Edited: 0000693 | |
2011-03-15 14:44 | ajosey | Interp Status | Pending => Proposed |
2011-03-15 14:44 | ajosey | Note Added: 0000700 | |
2011-03-17 21:59 | eblake | Relationship added | related to 0000398 |
2011-04-26 15:10 | ajosey | Interp Status | Proposed => Approved |
2011-04-26 15:10 | ajosey | Note Added: 0000763 | |
2013-04-16 13:06 | ajosey | Status | Interpretation Required => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |