View Issue Details

IDProjectCategoryView StatusLast Update
00001851003.1(2008)/Issue 7System Interfacespublic2013-04-16 13:06
Reportereblake Assigned Toajosey  
PrioritynormalSeverityEditorialTypeError
Status ClosedResolutionAccepted 
NameEric Blake
OrganizationNA
User Referenceebb.setenv
Sectionsetenv
Page Number1857
Line Number59356
Interp StatusApproved
Final Accepted Text0000185:0000318
Summary0000185: setenv failure case
DescriptionThere is a typo in the EINVAL error for setenv.

Meanwhile, many existing BSD implementations crash or give EFAULT, rather than failing with EINVAL, when invoking setenv(NULL,"",0). Therefore, use of a null pointer is already non-portable in practice, and removing the requirement for a null pointer check allows for a faster implementation. Omission of a requirement for a check for a null pointer could invalidate existing applications, but the likelihood of a compliant application expecting setenv(NULL,"",0) to fail with EINVAL is minimal (given that such an application could crash when ported to BSD, and that wasting the time on a call known to not update environ seems pointless). On the other hand, omitting the requirement would allow more existing implementations to be compliant, without penalizing any existing implementation that performs the null pointer check, since the standard already has an overriding statement that if not explicitly mentioned otherwise, use of a null pointer gives unspecified behavior. Therefore, this proposal includes a change to relax the requirement regarding a null pointer check.

This is orthogonal to issue 167, although it touches the same interfaces.

Meanwhile, note that neither putenv("=") nor getenv("") are required to fail with EINVAL, although in practice, behavior varies widely on whether environ can successfully be managed if it contains an entry whose first character is '='. The desired action makes no attempt to change this.
Desired ActionAt line 59356 (setenv), change

[EINVAL] The name argument is a null pointer, points to an empty string, or points to a string containing an ’=’ character.

to

[EINVAL] The envname argument points to an empty string or points to a string containing an ’=’ character.

At line 68264 (unsetenv), change

[EINVAL] The name argument is a null pointer, points to an empty string, or points to a string containing an ’=’ character.

to

[EINVAL] The name argument points to an empty string or points to a string containing an ’=’ character.
Tagstc1-2008

Activities

msbrown

2009-12-03 16:44

manager   bugnote:0000318

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

The standard states the requirements for EINVAL in setenv(), and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
-------------

None.

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

Make the change suggested by the submitter.

Issue History

Date Modified Username Field Change
2009-11-16 16:02 eblake New Issue
2009-11-16 16:02 eblake Status New => Under Review
2009-11-16 16:02 eblake Assigned To => ajosey
2009-11-16 16:02 eblake Name => Eric Blake
2009-11-16 16:02 eblake Organization => NA
2009-11-16 16:02 eblake User Reference => ebb.setenv
2009-11-16 16:02 eblake Section => setenv
2009-11-16 16:02 eblake Page Number => 1857
2009-11-16 16:02 eblake Line Number => 59356
2009-12-03 16:44 msbrown Interp Status => Pending
2009-12-03 16:44 msbrown Note Added: 0000318
2009-12-03 16:44 msbrown Status Under Review => Interpretation Required
2009-12-03 16:44 msbrown Resolution Open => Accepted
2009-12-03 16:46 geoffclare Final Accepted Text => 0000185:0000318
2010-02-12 06:38 ajosey Interp Status Pending => Proposed
2010-03-25 15:17 ajosey Interp Status Proposed => Approved
2010-09-24 14:23 Don Cragun Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Interpretation Required => Closed