autoconf-patches
[Top][All Lists]
Advanced

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

Another ash braindamage (testsuite only)


From: Pavel Roskin
Subject: Another ash braindamage (testsuite only)
Date: Wed, 11 Oct 2000 15:23:47 -0400 (EDT)

Hello!

The testsuite uses a construct "$at_failed && exit 1" where
at_failed="false" for successful tests.

The problem is that the code immediately after that relies on $?. In fact,
$? is normally (in bash) reset to 0 by executing $at_traceon, which is
normally empty because at_traceon is not set.

This is too fragile to be portable. This script prints 0 under bash and 1
under ash-0.2 (but not ash-0.3.4 and above):

#! /bin/sh
false
$FOO
echo $?

The fix is to use "if" with ":" in the "else" part.

ChangeLog:
        * tests/atgeneral.m4 (AT_CHECK): Make sure that $? is set to 0
        if diffs have succeded.

========================
--- tests/atgeneral.m4  Thu Sep 21 05:11:08 2000
+++ tests/atgeneral.m4  Wed Oct 11 14:29:04 2000
@@ -397,7 +397,11 @@
 $at_diff experr stderr || at_failed=:],
           [], [$at_diff empty stderr || at_failed=:],
           [echo $at_n "patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - 
stderr || at_failed=:])
-  $at_failed && exit 1
+  if $at_failed; then
+    exit 1
+  else
+    :
+  fi
 fi
 $at_traceon
 ])# AT_CHECK
========================

Regards,
Pavel Roskin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]