autoconf-patches
[Top][All Lists]
Advanced

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

Re: 39-exit-status.patch


From: Pavel Roskin
Subject: Re: 39-exit-status.patch
Date: Mon, 26 Feb 2001 12:42:28 -0500 (EST)

Hello, Akim!

I'm not a Perl guru, and maybe I don't quite understand you doubts, but
I'll try to anser the questions that I can answer.

> 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.

You are missing one important point.

>        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

If `$!' is `0'!!! This is not the case if system() fails. In this case the
exit status is in the upper byte of $!, and we _really_ want to preserve
it, because we are almost sure that m4 can be invoked, so we are more
interested in the exit code that in the success of the waitpid(). That's
why are using ">> 8".

>                `($? >> 8)' (backtick `command` status).  If `($?
>                >> 8)' is `0', exits with `255'.  Inside an

... so if the upper byte is 0 but system() has failed (don't know if it's
possible), we are still protected against returning 0 on error.

>                `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?

END is read and executed (try adding `warn "point 1";' there). I don't
know how it's contents supposed to work, but fortunately it doesn't seem
to interfere with that particular die() after system().

Regards,
Pavel Roskin




reply via email to

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