Re: Interesting problem in timezoneconf package

2003-07-27 Thread Colin Watson
On Sun, Jul 27, 2003 at 09:24:55AM +0200, Christian Perrier wrote:
 The dh_installdocs part comes from a #DEBHELPER# in
 debian/postinst. 
 
 When recompiling now, this doesnt exist anymore and thus we end up
 with?:
 
 
 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.

-- 
Colin Watson  [EMAIL PROTECTED]




Re: Interesting problem in timezoneconf package

2003-07-27 Thread Junichi Uekawa
  
  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?


regards,
junichi




Re: Interesting problem in timezoneconf package

2003-07-27 Thread Colin Watson
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  [EMAIL PROTECTED]




Re: Interesting problem in timezoneconf package

2003-07-27 Thread Thomas Hood
On Sun, 2003-07-27 at 12:44, Colin Watson wrote:
 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.

I just tested this too, because I thought that one had to do

   [ $CTL != yes ] || takeaction

rather than

   [ $CTL = yes ]  takeaction

when -e was set in order to avoid immediate exit on the failure
of the $CTL=yes test.  Experiments prove that neither of
these causes immediate exit, even though the second one does
have a nonzero status when $CTL != yes.

--
Thomas