Defect report from : Paul Eggert , UCLA
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 96 line 3663 section trap objection {20060125a}
Problem:
Edition of Specification (Year): 2004
Defect code : 1. Error
POSIX requires that the command "trap 0 INT" must cause the shell to
execute the command "0" when an interrupt condition arises. With the
XSI extension, "trap 0 2" must have the same effect as "trap 0 INT".
However, common practice (e.g., Bash 3.1, Ksh M-12/28/93d) is to treat
these commands as if they were "trap - 0 INT". This is to cater to
7th Edition Unix, where "trap 0 2" had the effect that "trap - 0 INT"
does now.
Similarly, common practice is that "trap 2 INT" is treated as if it
were "trap - 2 2".
Action:
On XCU page 96 line 3663, change the SYNOPSIS from:
trap [_action_ _condition_ ...]
to:
trap _n_ [_condition_ ...]
trap [_action_ _condition_ ...]
On XCU page 96 line 3665, change:
If _action_ is '-', the shell shall reset each _condition_ to
the default value....
to:
If the first operand is an unsigned decimal integer, the
shell shall treat all operands as conditions, and shall
reset each condition to the default value.
Otherwise, if there are operands, the first is treated as an action
and the remaining as conditions.
If _action_ is '-', the shell shall reset each _condition_ to
the default value....
After XCU page 98 line 3762, insert this text:
The command
trap '$cmd' 0
causes the contents of the shell variable *cmd* to be executed as a
command when the shell exits. Using double-quotes instead of
single-quotes might have unexpected behavior, since in theory the
value of *cmd* might be a decimal integer which would be treated as
a condition, not an action; or *cmd* might begin with "-". Also,
using double-quotes will cause the value of *cmd* to be expanded
twice, once when *trap* is executed, and once when the condition
arises.
|