View Issue Details

IDProjectCategoryView StatusLast Update
00003521003.1(2008)/Issue 7Shell and Utilitiespublic2014-04-10 14:44
Reportereblake Assigned Toajosey  
PrioritynormalSeverityObjectionTypeError
Status ClosedResolutionAccepted As Marked 
NameEric Blake
OrganizationRed Hat
User Referenceebb.export2
Sectionexport
Page Number2349
Line Number74290
Interp StatusApproved
Final Accepted Text0000352:0000619
Summary0000352: behavior when assignments precede export
DescriptionHistorically, ksh has treated any assignments in the environment given to
export as marking those variables for export. Bash copied this behavior,
but only in POSIX mode (in non-posix mode, bash does not propagate
any assignments preceding a special built-in into the current environment);
other shells modify the current environment (as required for all special
built-ins) but without setting the export attribute:

$ ksh -c 'a=1 export b=2; export -p | grep " [ab]="; echo "$a.$b"'
export a=1
export b=2
1.2
$ bash -c 'a=1 export b=2; export -p | grep " [ab]="; echo "$a.$b"'
declare -x b="2"
.2
$ bash --posix -c 'a=1 export b=2; export -p | grep " [ab]="; echo "$a.$b"'
export a="1"
export b="2"
1.2
$ dash -c 'a=1 export b=2; export -p | grep " [ab]="; echo "$a.$b"'
export b='2'
1.2

This proposal explicitly allows both ksh and dash behaviors.

No change is needed for readonly, since ksh matches all other shells in
only marking variables as readonly if they were listed after the command
name.
Desired ActionAt line 74290, add a sentence:

If any variable assignments preceded the command name of 'export', those
variables shall be set in the current execution environment after the
completion of the command, but it is unspecified whether those variables
will be marked for export.

Tagstc1-2008

Relationships

related to 0000351 Closedajosey 1003.1(2008)/Issue 7 certain shell special built-ins should expand arguments in assignment context 
related to 0000654 Closedajosey 1003.1(2013)/Issue7+TC1 unclear behavior of in-line variable assignments preceding functions, special built-ins 
related to 0000960 Closed 1003.1(2013)/Issue7+TC1 export can fail 

Activities

geoffclare

2010-11-18 17:19

manager   bugnote:0000619

Interpretation response
------------------------
The standard states the requirements for the export special built-in,
and conforming implementations must conform to this. However, concerns
have been raised about this which are being referred to the sponsor.

Rationale:
-------------
The standard does not allow long-standing existing practice.

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

At line 74290, add a sentence:

If a variable assignment precedes the command name of 'export' but
that variable is not also listed as an operand of 'export', then that
variable shall be set in the current shell execution environment after
the completion of the 'export' command, but it is unspecified whether
that variable is marked for export.

ajosey

2010-12-16 16:13

manager   bugnote:0000635

Comments are due on this interpretation by January 16 2011

Issue History

Date Modified Username Field Change
2010-11-09 19:13 eblake New Issue
2010-11-09 19:13 eblake Status New => Under Review
2010-11-09 19:13 eblake Assigned To => ajosey
2010-11-09 19:13 eblake Name => Eric Blake
2010-11-09 19:13 eblake Organization => Red Hat
2010-11-09 19:13 eblake User Reference => ebb.export2
2010-11-09 19:13 eblake Section => export
2010-11-09 19:13 eblake Page Number => 2349
2010-11-09 19:13 eblake Line Number => 74290
2010-11-09 19:13 eblake Interp Status => ---
2010-11-18 17:19 geoffclare Interp Status --- => Pending
2010-11-18 17:19 geoffclare Note Added: 0000619
2010-11-18 17:19 geoffclare Status Under Review => Interpretation Required
2010-11-18 17:19 geoffclare Resolution Open => Accepted As Marked
2010-11-18 17:19 geoffclare Final Accepted Text => 0000352:0000619
2010-11-18 17:20 geoffclare Tag Attached: tc1-2008
2010-12-16 16:13 ajosey Interp Status Pending => Proposed
2010-12-16 16:13 ajosey Note Added: 0000635
2011-01-18 12:30 ajosey Interp Status Proposed => Approved
2013-02-07 08:05 rhansen Relationship added related to 0000654
2013-04-16 13:06 ajosey Status Interpretation Required => Closed
2014-04-10 14:44 eblake Relationship added related to 0000351
2015-06-18 15:04 eblake Relationship added related to 0000960