NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/38736 (/bin/sh: several problems with 'set -e')



The following reply was made to PR bin/38736; it has been noted by GNATS.

From: Aleksey Cheusov <cheusov%tut.by@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: tron%NetBSD.org@localhost,  netbsd-bugs%netbsd.org@localhost,  
gnats-admin%netbsd.org@localhost
Subject: Re: bin/38736 (/bin/sh: several problems with 'set -e')
Date: Mon, 26 May 2008 22:51:33 +0300

 > Synopsis: /bin/sh: several problems with 'set -e'
 
 > State-Changed-From-To: open->closed
 > State-Changed-By: tron%NetBSD.org@localhost
 > State-Changed-When: Mon, 26 May 2008 14:58:25 +0000
 > State-Changed-Why:
 > At least one of your examples ("! true") is explicitly listed as an
 > exception of the "set -e" behaviour in the POSIX spec:
 
 > http://www.opengroup.org/onlinepubs/000095399/utilities/set.html
 No. You read this spec incorrectly. Reread it.
 
 Subsentence that describes `!' case:
 
   "-e When this option is on, if a simple command fails for any of the
   reasons listed in Consequences of Shell Errors or returns an exit
   status value >0, and is not a pipeline preceded by the ! reserved
   word, then the shell shall immediately exit.
 
 "simple command" here means 'true' WITHOUT leading '!' (see below).
 Therefore, this sentence is about '! false' which should not exit from
 shell script.  This is obviously because the exit status of whole
 command if TRUE.
 
    
http://www.opengroup.org/onlinepubs/000095399/utilities/xcu_chap02.html#tag_02_09_01
    "A "simple command" is a sequence of optional variable assignments
    and redirections, in any sequence, optionally followed by words and
    redirections, terminated by a control operator."
 
 Another definitions:
 
    "2.9.2 Pipelines
    A pipeline is a sequence of one or more commands
    separated by the control operator '|'." (ONE OR MORE!)
 
    "A command is one of the following: Simple command (see Simple
    Commands) Pipeline (see Pipelines) List compound-list (see Lists)
    Compound command (see Compound Commands) Function definition (see
    Function Definition Command)"
 
 > Please compose a new list of test cases and compare them *carefully*
 > with the spec and submit a new PR.
 Do not close bugs if they are not fixed.
 
 -- 
 Best regards, Aleksey Cheusov.
 


Home | Main Index | Thread Index | Old Index