Email List: Xaustin-review-lX
[All Lists]

Defect in XCU trap

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XCU trap
From: yyyyyy@xxxxxxxxxxx
Date: Thu, 26 Jan 2006 00:26:23 GMT
Resent-date: Thu, 26 Jan 2006 10:21:18 +0000
Resent-from: Andrew Josey <yyyyyy@xxxxxxxxxxxxxxxxx>
Resent-message-id: <1060126102118.ZM4674@xxxxxx>
Resent-to: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
        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.

<Prev in Thread] Current Thread [Next in Thread>
  • Defect in XCU trap, eggert <=