-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [adding m4-patches]
According to Jean-Charles Longuet on 5/21/2008 2:10 PM: | | When m4 fails to open() the frozen state file, it complains | but the process exit code is still 0. However, the same function | may trigger failures leading to a non-zero process exit code, | for example when the close() of the frozen state file fails. Thanks for the report. Which version of m4 was this against? I'm guessing this was against a release tarball, rather than the current git repository, since this area of code has changed in the meantime? | | Wouldn't it be consistent to also exit on open() failures, | with this one-line patch or equivalent ? abort() is too strong - users should not get a core dump merely because they requested a file that can't be opened. So I'll be applying this instead: - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkg07bkACgkQ84KuGfSFAYDg3ACgkAWSHOmo/6ZEJN0UfFFjvpQO rEsAoNS6qOHX6jvJYYsKNaBRToRPVhmB =UMHy -----END PGP SIGNATURE-----
>From ebc0275ff983bf9016ffb4f19eb5a4c678691b54 Mon Sep 17 00:00:00 2001 From: Eric Blake <[EMAIL PROTECTED]> Date: Wed, 21 May 2008 21:49:54 -0600 Subject: [PATCH] Don't allow failure to freeze give exit status of 0. * src/freeze.c (produce_frozen_state): Die rather than warn. * doc/m4.texinfo (Using frozen files): Test it. * THANKS: Update. Reported by Jean-Charles Longuet. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> --- ChangeLog | 8 ++++++++ THANKS | 1 + doc/m4.texinfo | 10 ++++++++++ src/freeze.c | 5 +---- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2abc489..9307dda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-22 Eric Blake <[EMAIL PROTECTED]> + + Don't allow failure to freeze give exit status of 0. + * src/freeze.c (produce_frozen_state): Die rather than warn. + * doc/m4.texinfo (Using frozen files): Test it. + * THANKS: Update. + Reported by Jean-Charles Longuet. + 2008-05-09 Eric Blake <[EMAIL PROTECTED]> Improve error message when frozen file is invalid. diff --git a/THANKS b/THANKS index 19c1d92..1fa9ba5 100644 diff --git a/doc/m4.texinfo b/doc/m4.texinfo index 3131e9a..380bc34 100644 --- a/doc/m4.texinfo +++ b/doc/m4.texinfo @@ -6993,6 +6993,16 @@ ifdef(`__unix__', , ')m4exit(`77')')dnl traceon(`undefined')dnl @end example + [EMAIL PROTECTED] Make sure freezing is successful. + [EMAIL PROTECTED] options -F /none/such [EMAIL PROTECTED] status: 1 [EMAIL PROTECTED] +$ @kbd{m4 -F /none/such} +^D [EMAIL PROTECTED]: cannot open /none/such: No such file or directory [EMAIL PROTECTED] example @end ignore When an @code{m4} run is to be frozen, the automatic undiversion diff --git a/src/freeze.c b/src/freeze.c index 15f06fe..2734efa 100644 --- a/src/freeze.c +++ b/src/freeze.c @@ -58,10 +58,7 @@ produce_frozen_state (const char *name) file = fopen (name, O_BINARY ? "wb" : "w"); if (!file) - { - m4_error (0, errno, NULL, _("cannot open %s"), name); - return; - } + m4_error (EXIT_FAILURE, errno, NULL, _("cannot open %s"), name); /* Write a recognizable header. */ -- 1.5.5.1