View Issue Details

IDProjectCategoryView StatusLast Update
00013841003.1(2016/18)/Issue7+TC2Shell and Utilitiespublic2024-06-11 09:08
Reportergeoffclare Assigned To 
PrioritynormalSeverityObjectionTypeOmission
Status ClosedResolutionAccepted As Marked 
NameGeoff Clare
OrganizationThe Open Group
User Reference
Section2.12 Shell Execution Environment
Page Number2382
Line Number76195-76202
Interp Status---
Final Accepted Text0001384:0005198
Summary0001384: Subshell of an interactive shell is effectively non-interactive
DescriptionThe standard is missing a statement to the effect that a subshell of an interactive shell behaves as a non-interactive shell (despite the fact that $- and "set +o" indicate it is interactive).

For example, in all shells I tried, the subshell in the following is terminated by SIGTERM. (Some wrote "Terminated" between the two lines, others didn't, but the $? value in all of them indicated termination with SIGTERM and none of them wrote "foo".)
$ (pid=$(sh -c 'echo $PPID'); kill -s TERM "$pid"; echo foo)
$ echo $?
If the subshell was behaving as per the standard's requirements for an interactive shell, the SIGTERM would be ignored, the echo would be executed, and $? would be 0.

The current statement about traps in 2.12 is also out of date with respect to the description of the trap utility.
Desired ActionOn page 2382 line 76195 section 2.12 Shell Execution Environment,
after applying bug 1247 change:
A subshell environment shall be created as a duplicate of the shell environment, except that traps that are not being ignored shall be set to the default action.
to:
A subshell environment shall be created as a duplicate of the shell environment, except that:
  • Unless specified otherwise (see [xref to trap]), traps that are not being ignored shall be set to the default action.

  • If the shell is interactive, the subshell shall behave as a non-interactive shell in all respects other than the expansion of the special parameter '-' and the output of <tt>set -o</tt> and <tt>set +o</tt>, which shall continue to indicate that it is interactive.

Tagstc3-2008

Relationships

related to 0001427 Closed 2.8.1 does not take into account "command" 

Activities

rhansen

2021-01-11 16:45

manager   bugnote:0005198

Last edited: 2021-01-14 16:30

On page 2382 line 76195 section 2.12 Shell Execution Environment,
after applying bug 1247 change:
A subshell environment shall be created as a duplicate of the shell environment, except that traps that are not being ignored shall be set to the default action.
to:
A subshell environment shall be created as a duplicate of the shell environment, except that:
  • Unless specified otherwise (see [xref to trap]), traps that are not being ignored shall be set to the default action.
  • If the shell is interactive, the subshell shall behave as a non-interactive shell in all respects except:
    • The expansion of the special parameter '-' may continue to indicate that it is interactive.
    • The <tt>set -n</tt> option may be ignored.

On page 2411 line 77159 (XCU 2.14 set -n) change:
An interactive shell may ignore this option.
to:
Interactive shells and subshells of interactive shells, recursively, may ignore this option.


rhansen

2021-01-14 16:31

manager   bugnote:0005200

Last edited: 2021-01-14 16:37

0001384:0005198 was edited to change "and the output of <tt>set -o</tt> and <tt>set +o</tt> shall" to "may" in response to a comment on the mailing list:

https://www.mail-archive.com/austin-group-l@opengroup.org/msg07384.html

Issue History

Date Modified Username Field Change
2020-07-29 09:02 geoffclare New Issue
2020-07-29 09:02 geoffclare Name => Geoff Clare
2020-07-29 09:02 geoffclare Organization => The Open Group
2020-07-29 09:02 geoffclare Section => 2.12 Shell Execution Environment
2020-07-29 09:02 geoffclare Page Number => 2382
2020-07-29 09:02 geoffclare Line Number => 76195-76202
2020-07-29 09:02 geoffclare Interp Status => ---
2020-12-01 16:28 geoffclare Relationship added related to 0001427
2021-01-11 16:45 rhansen Note Added: 0005198
2021-01-11 16:47 rhansen Final Accepted Text => 0001384:0005198
2021-01-11 16:47 rhansen Status New => Resolved
2021-01-11 16:47 rhansen Resolution Open => Accepted As Marked
2021-01-11 16:47 rhansen Tag Attached: tc3-2008
2021-01-14 16:30 rhansen Note Edited: 0005198
2021-01-14 16:31 rhansen Note Added: 0005200
2021-01-14 16:33 rhansen Note Edited: 0005200
2021-01-14 16:33 rhansen Note Edited: 0005200
2021-01-14 16:33 rhansen Note Edited: 0005200
2021-01-14 16:37 rhansen Note Edited: 0005200
2021-01-29 11:27 geoffclare Status Resolved => Applied
2024-06-11 09:08 agadmin Status Applied => Closed