According to Ralf Wildenhues on 2/28/2010 7:09 AM: >>> checking whether the C compiler works... no >>> ../../tests/c.at:66: exit code was 1, expected 77 >> >> The second is us failing to adhere to '(autoconf.info)Shell Functions': >> Likewise, the state of `$?' is not reliable when entering a shell >> function.
Bummer. I got caught.
>>
>> in AS_ERROR. The first seems to be a genuine shell error difference
>> (from glancing at SUSv3 I can only gather that a failed redirection
>> should result in an exit status > 0, but no further specification).
That's correct; so we do have to normalize $? in that case.
> I'm testing these two patches right now. I didn't see an easy way to
> keep as_fn_error API-compatible in the presence of trailing optional
> arguments, so aren't we glad we didn't publish that function. Still
> feel a bit uneasy about the first patch, as we don't cover AS_ERROR
> fully in the testsuite (e.g., the two-argument version). So, close
> review is appreciated. Thanks. (Sending them with format-patch in
> case you want to go ahead and apply them, Eric.)
I've got a nit on the first patch anyway, so I'll let you apply them if
you read this before I'm awake tomorrow.
> Subject: [PATCH 1/4] Fix AS_ERROR for FreeBSD sh.
1/4? What happened to 3/4 and 4/4? :)
>
> * lib/m4sugar/m4sh.m4 (_AS_ERROR_PREPARE): Rewrite as_fn_error
> to take additional first argument STATUS instead of transporting
> $? across shell function entry, which does not work with FreeBSD
> sh. Shift all other arguments by one, adjust.
> (AS_ERROR): Pass EXIT-STATUS, defaulting to $?, to as_fn_error.
> * THANKS: Update.
> Report by Václav Haisman.
The patch looks correct, but...
> @@ -842,9 +842,8 @@ _m4_popdef([AS_MESSAGE_LOG_FD])dnl
> m4_defun_init([AS_ERROR],
> [m4_append_uniq([_AS_CLEANUP],
> [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])],
> -[m4_ifvaln([$2], [{ AS_SET_STATUS([$2])])]dnl
> -[as_fn_error "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD,
> - [ "$LINENO" AS_MESSAGE_LOG_FD])[]m4_ifval([$2], [; }])])
> +[as_fn_error m4_default([$2], [$?])
> "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD,
> + [ "$LINENO" AS_MESSAGE_LOG_FD])])
This can be simplified, to calling as_fn_error $? "_AS_QUOTE([$1])"...
Why? Because we just called AS_SET_STATUS([$2]) the line before, so $? is
guaranteed to be the correct value. And one less m4_default is that much
less m4 effort.
> * tests/tools.at (autom4te cache creation): Normalize exit
> status of failed redirection to 1, may be 2 with FreeBSD sh.
> Report by Václav Haisman.
Ready to go.
--
Don't work too hard, make some time for fun as well!
Eric Blake [email protected]
signature.asc
Description: OpenPGP digital signature
