View Issue Details

IDProjectCategoryView StatusLast Update
00004601003.1(2008)/Issue 7System Interfacespublic2013-04-16 13:06
Reportereblake Assigned Toajosey  
PrioritynormalSeverityObjectionTypeError
Status ClosedResolutionAccepted 
NameEric Blake
OrganizationRed Hat
User Referenceebb.getopt
Sectiongetopt
Page Number1041
Line Number34860
Interp StatusApproved
Final Accepted TextSee 0000460:0000859
Summary0000460: detecting stderr write failures during getopt, wordexp
DescriptionBoth the getopt() and wordexp() commands are documented as writing error
messages to stderr under certain conditions, yet neither function defines
the state of the error flag on the stderr stream or the state of errno
after such failures.

However, these functions are rather high level, and there are probably
existing implementations that do not guarantee that errno is unchanged
on success; furthermore, in the wordexp case, the output to stderr is
often done by a child process and thus does not reflect a write failure
back to the parent process.
Desired ActionAt line 34860 [XSH getopt ERRORS], change "No errors are defined" to:

If the application has not set the variable opterr to 0, the first
character of optstring is not a <colon>, and a write error occurs
while getopt( ) is printing a diagnostic message to stderr, then the
error indicator for stderr shall be set; but getopt( ) shall still
succeed and the value of errno after getopt( ) is unspecified.

At line 34980 [XSH getopt APPLICATION USAGE], add a new paragraph:

While ferror(stderr) may be used to detect failures to write a
diagnostic to stderr when getopt( ) returns '?', the value of errno
is unspecified in such a condition. Applications desiring more
control over handling write failures should set opterr to 0 and
independently perform output to stderr, rather than relying on
getopt( ) to do the output.

At line 71005 [XSH wordexp DESCRIPTION], change:

If WRDE_SHOWERR is set, wordexp( ) may write messages to stderr if
syntax errors are detected while expanding words.

to:

If WRDE_SHOWERR is set, wordexp( ) may write messages to stderr if
syntax errors are detected while expanding words; however, it is
unspecified whether any write errors encountered while outputting such
messages will affect the stderr error indicator or the value of errno.

At line 71038 [XSH wordexp APPLICATION USAGE], add a paragraph:

Even though the WRDE_SHOWERR flag allows the implementation to write
messages to stderr during command substitution or syntax errors, the
standard does not provide any way to detect write failures during
the output of such messages.
Tagstc1-2008

Activities

nick

2011-06-16 15:34

manager   bugnote:0000859

Interpretation response
------------------------

The standard does not speak to this issue, and as such no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.

Rationale:
-------------
None

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
See Desired Action

ajosey

2011-08-10 15:23

manager   bugnote:0000929

Interpretation proposed 10 August 2011 for final 30 day review

ajosey

2011-09-12 15:22

manager   bugnote:0000961

Interpretation approved 12 Sept 2011

Issue History

Date Modified Username Field Change
2011-06-07 20:03 eblake New Issue
2011-06-07 20:03 eblake Status New => Under Review
2011-06-07 20:03 eblake Assigned To => ajosey
2011-06-07 20:03 eblake Name => Eric Blake
2011-06-07 20:03 eblake Organization => Red Hat
2011-06-07 20:03 eblake User Reference => ebb.getopt
2011-06-07 20:03 eblake Section => getopt
2011-06-07 20:03 eblake Page Number => 1041
2011-06-07 20:03 eblake Line Number => 34860
2011-06-07 20:03 eblake Interp Status => ---
2011-06-16 15:34 nick Interp Status --- => Pending
2011-06-16 15:34 nick Note Added: 0000859
2011-06-16 15:34 nick Status Under Review => Interpretation Required
2011-06-16 15:34 nick Resolution Open => Accepted
2011-06-16 15:35 nick Tag Attached: tc1-2008
2011-06-16 15:35 nick Final Accepted Text => See 0000460:0000859
2011-08-10 15:23 ajosey Interp Status Pending => Proposed
2011-08-10 15:23 ajosey Note Added: 0000929
2011-09-12 15:22 ajosey Interp Status Proposed => Approved
2011-09-12 15:22 ajosey Note Added: 0000961
2013-04-16 13:06 ajosey Status Interpretation Required => Closed