autoconf-patches
[Top][All Lists]
Advanced

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

Re: 39-exit-status.patch


From: Akim Demaille
Subject: Re: 39-exit-status.patch
Date: 26 Feb 2001 17:46:36 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley)

Pavel Roskin <address@hidden> writes:

> Hello, Akim!
> 
> > 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";
> >         };
> 
> How about this:
> 
> ChangeLog:
>       * autoupdate.in: Preserve exit status of the failed command
>       when dying after system() by dividing $! by 256.
> 
> _________________
> --- autoupdate.in
> +++ autoupdate.in
> @@ -461,8 +461,8 @@
>         if $verbose;
>      if (system ("$m4 $tmp/input.m4 >$tmp/updated"))
>         {
> -      # FIXME: This guy is supposed to exit with a proper
> -      # exit status, but it does not.  Help is needed.
> +      # Exit status of system() is in the upper byte.
> +      $! >>= 8;
>        die "$me: cannot update \`$filename'\n";
>         };
> 
> _________________
> 
> It works just fine for me. The documentation for system() (man perlfunc)
> says that the error status is in the upper byte,
> 
> I'm sure that unlink and rmdir in &END have nothing to do with the
> problem.

Yep, I know this, but the documentation for die was saying it should
be automatic.  And in fact, it is automatic: it works fine when -d is
given, i.e., when END does not run unlink.

So I can't understand the relationship between your fix and the bug in
fact.  I think the problem is really inside END.

But I really agree I don't understand, your patch might be exactly
what is needed.  I just don't understand why.

       die LIST
               Outside an `eval', prints the value of LIST to
               `STDERR' and exits with the current value of `$!'
               (errno).  If `$!' is `0', exits with the value of
               `($? >> 8)' (backtick `command` status).  If `($?
               >> 8)' is `0', exits with `255'.  Inside an
               `eval(),' the error message is stuffed into `$@'
               and the `eval' is terminated with the undefined
               value.  This makes `die' the way to raise an
               exception.

This is why I try to neutralize $! to 0 in END.  But actually maybe
it's already too late, in END $! is no longer read?



reply via email to

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