Email List: Xaustin-group-lX
[All Lists]

[1003.1(2008)/Issue 7 0000185]: setenv failure case

To: austin-group-l@xxxxxxxxxxxxx
Subject: [1003.1(2008)/Issue 7 0000185]: setenv failure case
From: Austin Group Bug Tracker <noreply@xxxxxxxxxxxxx>
Date: Mon, 16 Nov 2009 16:02:10 +0000
Keywords: [1003.1(2008)/Issue 7] System Interfaces
The following issue has been SUBMITTED. 
====================================================================== 
http://austingroupbugs.net/view.php?id=185 
====================================================================== 
Reported By:                eblake
Assigned To:                ajosey
====================================================================== 
Project:                    1003.1(2008)/Issue 7
Issue ID:                   185
Category:                   System Interfaces
Type:                       Error
Severity:                   Editorial
Priority:                   normal
Status:                     Under Review
Name:                       Eric Blake 
Organization:               NA 
User Reference:             ebb.setenv 
Section:                    setenv 
Page Number:                1857 
Line Number:                59356 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2009-11-16 16:02 UTC
Last Modified:              2009-11-16 16:02 UTC
====================================================================== 
Summary:                    setenv failure case
Description: 
There 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 Action: 
At 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.

====================================================================== 

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           
======================================================================

<Prev in Thread] Current Thread [Next in Thread>