[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
39-exit-status.patch
From: |
Akim Demaille |
Subject: |
39-exit-status.patch |
Date: |
Sun, 25 Feb 2001 11:48:09 +0100 |
I need help on this one. The test suite fails because the exit status
is not properly set by END, because of unlink and rmdir which changes
$! and $? I guess.
I don't know what to do, I tried many things, but systematically
failed :( The idea is that
if (system ("$m4 $tmp/input.m4 >$tmp/updated"))
{
die "$me: cannot update \`$filename'\n";
};
have autoupdate exit (1), so maybe try to save $? and $! ? And
restore them at the end of END? But it does work, or I don't know how
to do that :(. Observe that with --debug it works! I suppose because
when --debug rmdir and unlink are not run :(.
To play with it:
echo "AC_PREREQ(1)" | ./autoupdate -A . -; echo $?
and
echo "AC_PREREQ(9)" | ./autoupdate -A . -; echo $?
(and play with -d too).
Index: ChangeLog
from Akim Demaille <address@hidden>
* autoupdate.in (&END): Try to preserve the exit status.
Use backquotes where more readable.
Internal details should be dumped when $debug, not when $verbose.
Index: autoupdate.in
--- autoupdate.in Sun, 25 Feb 2001 11:00:51 +0100 akim (ace/c/9_autoupdate 1.4
644)
+++ autoupdate.in Sun, 25 Feb 2001 11:33:40 +0100 akim (ace/c/9_autoupdate 1.4
644)
@@ -71,18 +71,26 @@ sub END
{
use POSIX qw (_exit);
+ my ($q) = ($?);
+
+ # FIXME: Heelp! Can't find a means to properly catch system's
+ # exit status (without hair I mean).
+ # my $status = $? >> 8;
+
if (!$debug && -d $tmp)
{
unlink <$tmp/*>
- or die "$me: cannot empty $tmp: $!\n";
+ or warn ("$me: cannot empty $tmp: $!\n"), _exit (1);
rmdir $tmp
- or die "$me: cannot remove $tmp: $!\n";
+ or warn ("$me: cannot remove $tmp: $!\n"), _exit (1);
}
# This is required if the code might send any output to stdout
# E.g., even --version or --help. So it's best to do it unconditionally.
close STDOUT
or (warn "$me: closing standard output: $!\n"), _exit (1);
+
+ ($!, $?) = (0, $q);
}
@@ -225,11 +233,7 @@ sub find_slaves ()
# @M4_BUILTINS -- M4 builtins and a useful comment.
-open M4_BUILTINS, "echo dumpdef | $m4 2>&1 >/dev/null |"
- or die "$me: cannot open: $!\n";
-my @m4_builtins = <M4_BUILTINS>;
-close M4_BUILTINS
- or die "$me: cannot close: $!\n";
+my @m4_builtins = `echo dumpdef | $m4 2>&1 >/dev/null`;
map { s/:.*//;s/\W// } @m4_builtins;
@@ -280,7 +284,7 @@ sub find_slaves ()
# Don't keep AU macros in @AC_MACROS.
delete $ac_macros{$_}
foreach (keys %au_macros);
-if ($verbose)
+if ($debug)
{
print STDERR "Current Autoconf macros:\n";
print STDERR join (' ', sort keys %ac_macros) . "\n\n";
@@ -451,8 +455,8 @@ sub find_slaves ()
if $verbose;
if (system ("$m4 $tmp/input.m4 >$tmp/updated"))
{
- # Don't let `die' with random errno.
- $! = 1;
+ # FIXME: This guy is supposed to exit with a proper
+ # exit status, but it does not. Help is needed.
die "$me: cannot update \`$filename'\n";
};
- 39-exit-status.patch,
Akim Demaille <=