m4-patches
[Top][All Lists]
Advanced

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

fix several regressions


From: Eric Blake
Subject: fix several regressions
Date: Mon, 20 Jul 2009 07:11:41 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Over the weekend, I identified several regressions introduced into m4
1.4.13 due to increased use of gnulib.  Many of these are corner cases
(and one appears to affect only cygwin 1.7), but they are all worth fixing
(and most of the fixes were made to gnulib over the weekend); I will
probably spin m4 1.4.14 in mid-August (I will be going on vacation next
week, and don't think I'll have time for the release this week).  All
three branches will need these fixes.

$ echo 'esyscmd(echo `dnl'\'' && exit 127)sysval' | m4-1.4.11
127
$ echo 'esyscmd(echo `dnl'\'' && exit 127)sysval' | m4-1.4.13
m4-1.4.13: esyscmd subprocess failed
127

$ echo 'esyscmd(echo hi >&2)dnl' > oops.m4
$ m4-1.4.11 oops.m4 <&- >&-
hi
$ m4-1.4.13 oops.m4 <&- >&-
m4-1.4.13: esyscmd subprocess failed

# I only see this crash on cygwin 1.7, and only if libsigsegv is in use:
$ echo | m4-1.4.11 >&-
m4-1.4.11: write error: Bad file descriptor
$ echo | m4-1.4.13 >&-
m4-1.4.13: internal error detected; please report this bug to
<address@hidden>: Segmentation fault

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----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

iEYEARECAAYFAkpkbQ0ACgkQ84KuGfSFAYBTyQCbBCqL/Ep/9LwMceq2DSM9RtbT
StgAoJQAz+0hAlUvekChVUvnOS9BaWeR
=AoOb
-----END PGP SIGNATURE-----
>From 5a83a105af3aab310b287e7d2fcc1a2fb192c323 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 17 Jul 2009 15:20:06 -0600
Subject: [PATCH 1/3] A status of 127 does not always imply esyscmd failure.

* src/builtin.c (m4_esyscmd): Silence gnulib message.
* src/builtin.c (m4_esyscmd): Silence gnulib message; regression
introduced 2009-03-05.
* NEWS: Document the change.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    8 ++++++++
 NEWS           |    8 ++++++++
 doc/m4.texinfo |    6 +++---
 src/builtin.c  |    2 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2a765b0..3bfa136 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-20  Eric Blake  <address@hidden>
+
+       A status of 127 does not always imply esyscmd failure.
+       * src/builtin.c (m4_esyscmd): Silence gnulib message; regression
+       introduced 2009-03-05.
+       * doc/m4.texinfo (Sysval): Test this.
+       * NEWS: Document the change.
+
 2009-06-25  Eric Blake  <address@hidden>

        Fix description of limits on diversions.
diff --git a/NEWS b/NEWS
index 8b3b8e9..485a143 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,14 @@ GNU M4 NEWS - User visible changes.
 Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006, 2007, 2008, 2009 Free
 Software Foundation, Inc.

+* Noteworthy changes in Version 1.4.14 (2009-??-??) [stable]
+  Released by Eric Blake, based on git version 1.4.13.*
+
+** Fix regression introduced in 1.4.13 in the `esyscmd' builtin, where
+   a child status of 127 made m4 print a spurious message to stderr.
+
+** A number of portability improvements inherited from gnulib.
+
 * Noteworthy changes in Version 1.4.13 (2009-04-01) [stable]
   Released by Eric Blake, based on git version 1.4.12.*

diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 48aa74e..eb76109 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -6615,10 +6615,10 @@ Sysval
 @result{}
 ifelse(sysval, `0', `zero', `non-zero')
 @result{}non-zero
-esyscmd(`exit 2')
+esyscmd(`echo dnl && exit 127')
 @result{}
 sysval
address@hidden
address@hidden
 esyscmd(`true')
 @result{}
 sysval
@@ -6629,7 +6629,7 @@ Sysval
 command, for example, if the system-imposed argument length is exceeded,
 or if there were not enough resources to fork.  It is not possible to
 distinguish between failed execution and successful execution that had
-an exit status of 127.
+an exit status of 127, unless there was output from the child process.

 On UNIX platforms, where it is possible to detect when command execution
 is terminated by a signal, rather than a normal exit, the result is the
diff --git a/src/builtin.c b/src/builtin.c
index 05146df..d416a00 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -1042,7 +1042,7 @@ m4_esyscmd (struct obstack *obs, int argc, token_data 
**argv)
     }
   if (ferror (pin) || fclose (pin))
     M4ERROR ((EXIT_FAILURE, errno, "cannot read pipe"));
-  status = wait_subprocess (child, ARG (0), false, false, true, false,
+  status = wait_subprocess (child, ARG (0), false, true, true, false,
                            &sig_status);
   if (sig_status)
     {
-- 
1.6.3.3.334.g916e1


>From 8fdfc7644ff117f54f0f5086d4e0282be9ed234e Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 20 Jul 2009 06:54:18 -0600
Subject: [PATCH 2/3] Avoid cygwin 1.7 crash with closed stdout.

* gnulib: Update.
* doc/m4.texinfo (Command line files): Add test; regression
introduced 2008-07-17.
* NEWS: Document the change.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    6 ++++++
 NEWS           |    3 +++
 doc/m4.texinfo |   13 +++++++++++++
 gnulib         |    2 +-
 4 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3bfa136..ea2a879 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-07-20  Eric Blake  <address@hidden>

+       Avoid cygwin 1.7 crash with closed stdout.
+       * gnulib: Update.
+       * doc/m4.texinfo (Command line files): Add test; regression
+       introduced 2008-07-17.
+       * NEWS: Document the change.
+
        A status of 127 does not always imply esyscmd failure.
        * src/builtin.c (m4_esyscmd): Silence gnulib message; regression
        introduced 2009-03-05.
diff --git a/NEWS b/NEWS
index 485a143..f3f65d4 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ Software Foundation, Inc.
 * Noteworthy changes in Version 1.4.14 (2009-??-??) [stable]
   Released by Eric Blake, based on git version 1.4.13.*

+** Fix regression introduced in 1.4.12 where executing with stdout closed
+   could crash m4 on exit on some platforms.
+
 ** Fix regression introduced in 1.4.13 in the `esyscmd' builtin, where
    a child status of 127 made m4 print a spurious message to stderr.

diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index eb76109..6c03ce7 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -960,6 +960,19 @@ Command line files
 @example
 @error{}m4: cannot open `Makefile/': Not a directory
 @end example
+
address@hidden Test that closed stderr does not cause a crash.
+
address@hidden
+ifdef(`__unix__', ,
+      `errprint(` skipping: syscmd does not have unix semantics
+')m4exit(`77')')dnl
+changequote(`[', `]')dnl
+syscmd([echo | ']__program__[' >&-])dnl
address@hidden: write error: Bad file descriptor
+sysval
address@hidden
address@hidden example
 @end ignore

 @node Syntax
diff --git a/gnulib b/gnulib
index e3e47d1..d19ab04 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit e3e47d1710f6154c54b65c5d9dd5d56516a893d6
+Subproject commit d19ab0454ad81cd702f17864f082aefcbea6687a
-- 
1.6.3.3.334.g916e1


>From 3c3ad4b14cb651bc50df923ef9598cf176d2f668 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 20 Jul 2009 07:08:27 -0600
Subject: [PATCH 3/3] Pick up gnulib fixes for sub-process execution.

* gnulib: Update.
* doc/m4.texinfo (Command line files): Add test; regression
introduced 2009-03-05.
* NEWS: Document the change.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    6 ++++++
 NEWS           |    3 ++-
 doc/m4.texinfo |    5 +++++
 gnulib         |    2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ea2a879..2a14a45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-07-20  Eric Blake  <address@hidden>

+       Pick up gnulib fixes for sub-process execution.
+       * gnulib: Update.
+       * doc/m4.texinfo (Command line files): Add test; regression
+       introduced 2009-03-05.
+       * NEWS: Document the change.
+
        Avoid cygwin 1.7 crash with closed stdout.
        * gnulib: Update.
        * doc/m4.texinfo (Command line files): Add test; regression
diff --git a/NEWS b/NEWS
index f3f65d4..bfb7ab7 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,8 @@ Software Foundation, Inc.
 ** Fix regression introduced in 1.4.12 where executing with stdout closed
    could crash m4 on exit on some platforms.

-** Fix regression introduced in 1.4.13 in the `esyscmd' builtin, where
+** Fix regressions introduced in 1.4.13 in the `esyscmd' builtin, where
+   closed file descriptors could interfere with child execution, and where
    a child status of 127 made m4 print a spurious message to stderr.

 ** A number of portability improvements inherited from gnulib.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 6c03ce7..5337ac8 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -972,6 +972,11 @@ Command line files
 @error{}m4: write error: Bad file descriptor
 sysval
 @result{}1
+syscmd([echo 'esyscmd(echo hi >&2)dnl' > tmp.m4 \
+  && ']__program__[' tmp.m4 <&- >&- \
+  && rm tmp.m4])sysval
address@hidden
address@hidden
 @end example
 @end ignore

diff --git a/gnulib b/gnulib
index d19ab04..deb58d4 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit d19ab0454ad81cd702f17864f082aefcbea6687a
+Subproject commit deb58d481fc8dc345e463002c7087a08a4f1d5f0
-- 
1.6.3.3.334.g916e1


reply via email to

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