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

Re: Interesting problem in timezoneconf package



On Sun, Jul 27, 2003 at 07:19:44PM +0900, Junichi Uekawa wrote:
[somebody broke attributions here]
> > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > > my $temp="set -e\nset -- @ARGV\n" . << 'EOF';
> > > if [ "$1" = "configure" ]; then
> > >     [ -x /usr/sbin/update-configlets ] && /usr/sbin/update-configlets
> > > fi
> > > 
> > > EOF
> > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > > 
> > > If /usr/sbin/update-configlets doesn't exist, the return code is then
> > > 1, thus explaining failure.
> > 
> > I always put 'exit 0' after #DEBHELPER# to prevent this problem.
> 
> I've had an impression that shell scripts won't go that far 
> if "set -e " was enabled. Thus, I've always thought " [ ] && xx" kind of 
> notation is mostly unusable, unless postfixed with a "|| true"
> 
> Or did I miss a some major point?

I tested this before posting. No, -e is a little more forgiving than
that, as stated in bash(1):

              -e      Exit  immediately if a simple command (see SHELL
                      GRAMMAR above) exits  with  a  non-zero  status.
                      The  shell  does  not  exit  if the command that
                      fails is part of an until or while loop, part of
                      an  if statement, part of a && or || list, or if
                      the command's return value is being inverted via
                      !.   A  trap  on ERR, if set, is executed before
                      the shell exits.

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: