* Eric Blake wrote on Tue, Mar 02, 2010 at 07:28:18AM CET:
> According to Ralf Wildenhues on 2/28/2010 7:09 AM:
> > Subject: [PATCH 1/4] Fix AS_ERROR for FreeBSD sh.
>
> 1/4? What happened to 3/4 and 4/4? :)
Unrelated. I've got plenty of junk patches not yet ready for general
consumption.
> > * 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.
Erm, the patch just removed that AS_SET_STATUS. If weighing m4 against
sh time, I usually try to go for lower sh time.
OK now?
Thanks, also for the other reviews,
Ralf