View Issue Details

IDProjectCategoryView StatusLast Update
00010291003.1(2013)/Issue7+TC1Shell and Utilitiespublic2024-06-11 08:57
Reporterrhansen Assigned To 
PrioritynormalSeverityObjectionTypeError
Status ClosedResolutionAccepted As Marked 
NameRichard Hansen
Organization
User Reference
Section2.14 trap
Page Number2391
Line Number76206-76207
Interp Status---
Final Accepted TextSee 0001029:0003510
Summary0001029: typo? in specification of $? after a trap action completes
DescriptionPage 2391 lines 76206-76207 (XCU 2.14 trap) says:
The value of <tt>"$?"</tt> after the trap action completes shall be the value it had before trap was invoked.

I believe "before the trap action was executed" was intended (it does not make sense to remember $? from before the trap utility was invoked).
Desired ActionOn page 2391 lines 76206-76207 (XCU 2.14 trap), change:
The value of <tt>"$?"</tt> after the trap action completes shall be the value it had before trap was invoked.

to:
The value of <tt>"$?"</tt> after the trap action completes shall be the value it had before the trap action was executed.

Tagstc3-2008

Activities

geoffclare

2016-02-23 15:04

manager   bugnote:0003084

Comparing the original POSIX.2-1992 text with the SUSv4 2013 edition, there are some places where POSIX.2 had "trap" with no special formatting and in SUSv4 these have italicised "trap" and (sometimes) dropped a preceding "the", thus turning them into references to the trap utility. The line reported here is one case. Others I have spotted are at line 76213:
The environment in which the shell executes a trap on EXIT shall be identical to the environment immediately after the last command executed before the trap on EXIT was taken.
and 76215:
Each time trap is invoked, the action argument shall be processed in a manner equivalent to:

<tt>eval action</tt>

There are probably more cases. We should double check every use of "trap" in section 2.14.

shware_systems

2016-02-23 15:53

reporter   bugnote:0003085

Perhaps spelling out "when a trapped signal or EXIT occurs" rather than "executes a trap" or "trap is invoked" cleaner for describing what the shell signal handlers are expected to do, and trap by itself limited to describing actions the utility performs in setting up how the shell responds.

rhansen

2016-12-08 16:09

manager   bugnote:0003510

(TC2 page and line numbers)

Change page 2399, lines 76765-76766 from:
A trap on EXIT shall be executed before the shell terminates, except when the exit utility is invoked in that trap itself, in which case the shell shall exit immediately.
to:
A trap action on EXIT shall be executed before the shell terminates, except when the exit utility is invoked in that trap action itself, in which case the shell shall exit immediately.

On page 2420 lines 77493-77494, change:
The value of <tt>"$?"</tt> after the trap action completes shall be the value it had before trap was invoked.
to:
The value of <tt>"$?"</tt> after the trap action completes shall be the value it had before the trap action was executed.

On page 2420 lines 77500-77502, change:
The environment in which the shell executes a trap on EXIT shall be identical to the environment immediately after the last command executed before the trap on EXIT was taken.

Each time trap is invoked, the action argument shall be processed in a manner equivalent to:

to:
The environment in which the shell executes a trap action on EXIT shall be identical to the environment immediately after the last command executed before the trap action on EXIT was executed.

If action is neither <tt>'-'</tt> nor the empty string, then each time a matching condition arises the action shall be executed in a manner equivalent to:

Issue History

Date Modified Username Field Change
2016-02-22 22:20 rhansen New Issue
2016-02-22 22:20 rhansen Name => Richard Hansen
2016-02-22 22:20 rhansen Section => 2.14 trap
2016-02-22 22:20 rhansen Page Number => 2391
2016-02-22 22:20 rhansen Line Number => 76206-76207
2016-02-22 22:20 rhansen Interp Status => ---
2016-02-23 15:04 geoffclare Note Added: 0003084
2016-02-23 15:53 shware_systems Note Added: 0003085
2016-12-08 16:09 rhansen Note Added: 0003510
2016-12-08 16:10 nick Final Accepted Text => See 0001029:0003510
2016-12-08 16:10 nick Status New => Resolved
2016-12-08 16:10 nick Resolution Open => Accepted As Marked
2016-12-08 16:10 nick Tag Attached: tc3-2008
2019-10-23 09:34 geoffclare Status Resolved => Applied
2024-06-11 08:57 agadmin Status Applied => Closed