regression on traceon(undef)defn(undef)

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What's worse, this is eerily similar to the bug I fixed for 1.4.5:
  echo 'indir(undef)' | m4 -t undef
I failed to add enough to the testsuite back then when I first realized
that traced but undefined symbols must be gracefully handled.  Both 1.4.11
and 1.4.10b are impacted.  Fortunately, this bug doesn't affect the master
branch, nor will it be tripped by clients like autoconf which always check
ifdef prior to defn.

- --
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

iEYEARECAAYFAkitZNwACgkQ84KuGfSFAYCEqACgrRaNQhyJVIytG1xEnEnVPEFg
pFcAn3/X94Hg+CPz5fpPIiIyify0YysJ
=KZve
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch372 (text/plain, 1.8 KB)
From 349bbb7400ee079878cb5859ee850a2b34a74c40 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Thu, 21 Aug 2008 06:50:50 -0600
Subject: [PATCH] Fix crash with traced defn(undef), regression from 2007-08-09.

* src/builtin.c (m4_defn): Handle traced but undefined macros.
* doc/m4.texinfo (Trace): Test it.
* NEWS: Document it.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog      |    7 +++++++
 doc/m4.texinfo |    4 +++-
 src/builtin.c  |    4 ++++
 3 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 51b3165..8c55d2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-21  Eric Blake  <[email protected]>
+
+	Fix crash with traced defn(undef), regression from 2007-08-09.
+	* src/builtin.c (m4_defn): Handle traced but undefined macros.
+	* doc/m4.texinfo (Trace): Test it.
+	* NEWS: Document it.
+
 2008-08-18  Eric Blake  <[email protected]>
 
 	Fix crash with 'm4 -N9', regression from 2006-09-14.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index d232c36..8ec4478 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -3553,6 +3553,8 @@ Trace
 @result{}
 foo
 @result{}foo
+defn(`foo')
+@result{}
 define(`foo', `bar')
 @result{}
 foo
@@ -3563,7 +3565,7 @@ Trace
 ifdef(`foo', `yes', `no')
 @result{}no
 indir(`foo')
-@error{}m4:stdin:8: undefined macro `foo'
+@error{}m4:stdin:9: undefined macro `foo'
 @result{}
 define(`foo', `blah')
 @result{}
diff --git a/src/builtin.c b/src/builtin.c
index 450b725..5ea886d 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -922,6 +922,10 @@ builtin `%s' requested by frozen file is not supported", ARG (i)));
 	    push_macro (b);
 	  break;
 
+	case TOKEN_VOID:
+	  /* Nothing to do for traced but undefined macro.  */
+	  break;
+
 	default:
 	  M4ERROR ((warning_status, 0,
 		    "INTERNAL ERROR: bad symbol type in m4_defn ()"));
-- 
1.6.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.