View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000279 | 1003.1(2008)/Issue 7 | Shell and Utilities | public | 2010-07-08 00:00 | 2011-06-23 15:33 |
| Reporter | calestyo | Assigned To | ajosey | ||
| Priority | normal | Severity | Editorial | Type | Clarification Requested |
| Status | Closed | Resolution | Rejected | ||
| Name | Christoph Anton Mitterer | ||||
| Organization | |||||
| User Reference | |||||
| Section | 2.12. | ||||
| Page Number | 2331 | ||||
| Line Number | 73695-73697,73699,73714-73715 | ||||
| Interp Status | --- | ||||
| Final Accepted Text | |||||
| Summary | 0000279: clarify inheritance of readonly and export variable flags as well as non-inheritance of set-flags | ||||
| Description | As far as I can tell, the standard does not cleanly specify the following information: 1) Apparently the "readonly" flag of variables is _not_ inherited. This should be specified. As far as I can tell, it is not told in any place of the standard. It should also be described if and how this is dependant of the export-flag. 2) Apparently the "export" flag _is_ inherited, and not only the variables it self. This should be specified. 3) Apparently, flags set via the "set" built-in utility are _not_ inherited. Although this is not strictly necessary, it would be nice, if this is clearly specified. | ||||
| Desired Action | Document the relevant sections. | ||||
| Tags | No tags attached. | ||||
|
|
The standard is intentionally silent regarding inheritance of the readonly attribute. Some shells inherit it and some don't. The export flag just means the variable is set as an environment variable (as opposed to just a shell variable). Inheritance of environment variables is well specified already. |
|
|
Then I guess it should be clarified, that inheritance of read-only is unspecified, which is not clearly told as you've said. Wouldn't it make sense however to request read-only not being inherited? e.g. Some Rationale already suggests, that shell scripts should set a sane default for IFS, which can be easily done e.g. via unset -v IFS This is however not possible if IFS has been marked read-only... That export is inherited only follows from section 2.12. where it says: >Variables with the export attribute, along with those explicitly exported >for the duration of the command, shall be passed to the utility environment >variables Right? That's difficult to find, so I really guess a further sentence explicitly stating this wouldn't harm. The same for set -e options (which AFAIU are not inherited). |
|
|
As noted by David Korn in austin-group-l email sequence number 14160:
This (the inheritance of the read-only flag) depends on which shell.
The Bourne shell inherited readonly for exported variables for scripts
invoked by name but not those invoked as sh script.
ksh inherits this flag for exported variables for both scripts invoked
by name or as sh script.
The standard was based on these two historical shells.
This is also noted in the first paragraph of the readonly utility rational. |
|
|
Would it be possible to change POSIX with respect to this? I guess a clear specification of whether read-only is to be inherited or not, would be useful (just take the example of setting IFS above). |
|
|
And if the above cannot be changed: I've now seen what section has documented this already in the Rationale "Some historical shells preserve the readonly attribute across separate invocations. This volume of POSIX.1-2008 allows this behavior, but does not require it." I'd (personally) like to read "shell execution environment" because IMO, that would make it much clearer, what is meant (instead of separate invocations). And it would also be better aligned with 2.12. Shell Execution Environment. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-07-08 00:00 | calestyo | New Issue | |
| 2010-07-08 00:00 | calestyo | Status | New => Under Review |
| 2010-07-08 00:00 | calestyo | Assigned To | => ajosey |
| 2010-07-08 00:00 | calestyo | Name | => Christoph Anton Mitterer |
| 2010-07-08 00:00 | calestyo | Section | => 2.12. |
| 2010-07-08 00:00 | calestyo | Page Number | => none |
| 2010-07-08 00:00 | calestyo | Line Number | => none |
| 2010-07-08 05:33 | Don Cragun | Page Number | none => 2331 |
| 2010-07-08 05:33 | Don Cragun | Line Number | none => 73695-73697,73699,73714-73715 |
| 2010-07-08 05:33 | Don Cragun | Interp Status | => --- |
| 2010-07-29 15:33 | geoffclare | Note Added: 0000480 | |
| 2010-07-29 15:33 | geoffclare | Status | Under Review => Resolved |
| 2010-07-29 15:33 | geoffclare | Resolution | Open => Rejected |
| 2010-07-29 17:16 | calestyo | Status | Resolved => Under Review |
| 2010-07-29 17:16 | calestyo | Resolution | Rejected => Reopened |
| 2010-07-29 17:18 | calestyo | Note Added: 0000490 | |
| 2010-08-19 15:52 | Don Cragun | Note Added: 0000529 | |
| 2010-08-19 15:52 | Don Cragun | Resolution | Reopened => Rejected |
| 2010-09-03 17:07 | calestyo | Note Added: 0000539 | |
| 2010-09-03 17:15 | calestyo | Note Added: 0000540 | |
| 2011-06-23 15:33 | msbrown | Status | Under Review => Closed |