autoconf-patches
[Top][All Lists]
Advanced

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

Re: Diagnose write errors in config.status


From: Ralf Wildenhues
Subject: Re: Diagnose write errors in config.status
Date: Fri, 16 Nov 2007 07:59:34 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Jim, Bruno,

* Jim Meyering wrote on Thu, Nov 15, 2007 at 11:54:05PM CET:
> Thanks for doing this.
> To make it slightly more portable, ...
> 
> ...
> > @@ -838,17 +840,22 @@ m4_define([_AC_OUTPUT_HEADER],
> >    # CONFIG_HEADER
> >    #
> >    if test x"$ac_file" != x-; then
> > -    AS_ECHO(["/* $configure_input  */"]) >"$tmp/config.h"
> > -    $AWK -f "$tmp/defines.awk" $ac_file_inputs >>"$tmp/config.h"
> > +    {
> > +      AS_ECHO(["/* $configure_input  */"]) \
> > +      && $AWK -f "$tmp/defines.awk" $ac_file_inputs
> > +    } >"$tmp/config.h" \
> > +      || AC_MSG_ERROR([could not create $ac_file])
> 
> shouldn't that be s/{/:;{/, above?

No need, because the {...} list isn't the first command executed by this
shell.  There's a whole script before that.

* Bruno Haible wrote on Fri, Nov 16, 2007 at 01:08:26AM CET:
> Ralf Wildenhues wrote:
> > I deliberately left out checking all the
> >   cat >$CONFIG_STATUS <<...
> > 
> > for now, my (weak) rationale being that with a write error, the
> > config.status file will likely be completely unusable anyway (and my
> > other one being laziness for now).  Do you think each one of them should
> > be checked as well?
> 
> It's not even sufficient to check only the last write, since "disk full"
> conditions may disappear as quickly as they appeared.

Agreed.  FWIW, I didn't suggest just checking the last one.

> Therefore the
> resulting config.status file will have some lines missing. But config.status
> is executed later on. If some random lines have been removed from it,
> it can overwrite arbitrary files in the system. (Or can you prove that it
> will behave harmlessly?)

I certainly cannot prove anything, esp. as writes may partially
successful.

> Also, don't think about speed here. Any performance loss will be caught by
> the next CPU generation, but if you leave unchecked writes in the script,
> the unreliability will stay there for 10 years or more.

Checking the exit statuses (stati?) won't cost much run time at all,
just script size.

I've applied this patch and will followup with another to check write
errors while writing config.status.

Note that you still have to worry that temporary write errors cause
bogus results in Autoconf tests.  We could guard against them while
writing conftest.c and the like, but it wouldn't help much as that
won't catch write errors in the compiler.  So the output and log
files need to be checked in any case.  At least that shouldn't cause
erroneous script behavior.

Cheers,
Ralf




reply via email to

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