View Issue Details

IDProjectCategoryView StatusLast Update
00005621003.1(2008)/Issue 7Shell and Utilitiespublic2012-05-10 15:15
Reportermscotts Assigned Toajosey  
PrioritynormalSeverityEditorialTypeOmission
Status ClosedResolutionDuplicate 
NameMatthew Story
OrganizationNYC*BUG
User Reference
Section2.9.1
Page Numberonline
Line Numberonline
Interp Status---
Final Accepted Text
Summary0000562: Optional Arguments Setting Current Execution Environment Is Not Noted for functions (only for built-ins)
DescriptionFrom section 2.9.1:

Otherwise, the variable assignments shall be exported for the execution environment of the command and shall not affect the current execution environment (except for special built-ins).

This exception should also include functions. Like special built-ins functions are also found via the Command Search and Execution and executed in the current execution environment (which necessitates that the current execution environment be altered for the required behavior).



Desired ActionThe text in 2.9.1 (Simple Commands):

Otherwise, the variable assignments shall be exported for the execution environment of the command and shall not affect the current execution environment (except for special built-ins).

should be modified to read:

Otherwise, the variable assignments shall be exported for the execution environment of the command and shall not affect the current execution environment (except for special built-ins and functions).
TagsNo tags attached.

Relationships

duplicate of 0000255 Closedajosey shell expansions in assignments that precede a command name 

Activities

mscotts

2012-05-03 18:45

reporter   bugnote:0001229

One additional note, I have verified that the exemption of functions is already the existing behavior for FreeBSD sh, dash and bash. It is likely the same for other shells as well.

chet_ramey

2012-05-03 20:11

reporter   bugnote:0001230

It's already specified to behave that way.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05

reads, in part:

When a function is executed, it shall have the syntax-error and variable-assignment properties described for special built-in utilities in the enumerated list at the beginning of Special Built-In Utilities .

We should make the suggested change for completeness.

mscotts

2012-05-03 21:23

reporter   bugnote:0001231

I had read that bit, my understanding of the Variable Assignment directive in 2.14 is for the a case like the following:

$ eval HI=foo
$ echo $HI
foo

or ... for functions:

$ foo() { HI=foo; }
$ foo
$ echo $HI
foo

not for the case of variable assignment via simple command. Although I certainly may have misunderstood that particular directive.

geoffclare

2012-05-04 08:09

manager   bugnote:0001232

This is already being fixed in TC1. See 0000255.

Issue History

Date Modified Username Field Change
2012-05-03 18:39 mscotts New Issue
2012-05-03 18:39 mscotts Status New => Under Review
2012-05-03 18:39 mscotts Assigned To => ajosey
2012-05-03 18:39 mscotts Name => Matthew Story
2012-05-03 18:39 mscotts Organization => NYC*BUG
2012-05-03 18:39 mscotts Section => 2.9.1
2012-05-03 18:39 mscotts Page Number => online
2012-05-03 18:39 mscotts Line Number => online
2012-05-03 18:45 mscotts Note Added: 0001229
2012-05-03 20:11 chet_ramey Note Added: 0001230
2012-05-03 21:23 mscotts Note Added: 0001231
2012-05-04 08:09 geoffclare Note Added: 0001232
2012-05-04 08:10 geoffclare Relationship added duplicate of 0000255
2012-05-10 15:15 geoffclare Interp Status => ---
2012-05-10 15:15 geoffclare Status Under Review => Closed
2012-05-10 15:15 geoffclare Resolution Open => Duplicate