m4-patches
[Top][All Lists]
Advanced

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

fix tracing output regression


From: Eric Blake
Subject: fix tracing output regression
Date: Wed, 30 Jul 2008 07:09:22 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

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

I introduced a latent bug in push_token in my argv_ref patch Stage 14 in
February, where I did not break the pointer from a cloned chain back into
the original chain when inlining the final element of the chain.  As long
as nothing accessed the chain until after push_string_finish, the stale
pointer was eventually corrected without anyone dereferencing it.  But
this bug then triggered a regression in Stage 23 in May, where trace was
changed to read the unfinished change, and thus the inlined link of the
chain appeared twice instead of once in trace output (the duplicate output
came from following the cloned chain back into the original chain,
followed by printing the inlined text).  Fixed as follows.  (Isn't it
strange how one line fixes the bug, and the bulk of the patch is merely
insurance that it doesn't relapse?)

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

iEYEARECAAYFAkiQaAIACgkQ84KuGfSFAYArTACghj14D95x8/JsXAxRk5o8WLdq
Jz4AnRKE3wiYEjUzLCuyp3ZVUmjqaXTV
=meMg
-----END PGP SIGNATURE-----
>From c9d53ab9bcef0cb04d59f5797e6f20159150b75d Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 30 Jul 2008 07:08:29 -0600
Subject: [PATCH] Fix regression in trace output, introduced 2008-05-09.

* src/input.c (push_token): When cloning chains, break pointer
back to original chain; latent bug from 2008-02-02 that did not
cause misbehavior until trace output read unfinished chain.
* doc/m4.texinfo (Trace): Add test for this.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    8 ++++++++
 doc/m4.texinfo |   16 ++++++++++++++++
 src/input.c    |    1 +
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 47449f2..d4f182e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-30  Eric Blake  <address@hidden>
+
+       Fix regression in trace output, introduced 2008-05-09.
+       * src/input.c (push_token): When cloning chains, break pointer
+       back to original chain; latent bug from 2008-02-02 that did not
+       cause misbehavior until trace output read unfinished chain.
+       * doc/m4.texinfo (Trace): Add test for this.
+
 2008-07-28  Eric Blake  <address@hidden>
 
        Optimize iteration examples.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index f8b3998..abacef9 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -3854,6 +3854,22 @@ indir(`my_defn', indir(`shift', `', `foo'))
 @result{}bar
 @end example
 
address@hidden
address@hidden not worth including in the manual, but this tests a trace code
address@hidden path that was temporarily broken
address@hidden options: -de --trace ifelse
address@hidden
+$ @kbd{m4 -de --trace ifelse}
+define(`e', `ifelse(`$1', `$2', `ifelse(`$1', `$2', `e(shift($@@))')')')
address@hidden
+e(`1', `1')
address@hidden: -1- ifelse -> ifelse(`1', `1', `e(shift(`1',`1'))')
address@hidden: -1- ifelse -> e(shift(`1',`1'))
address@hidden: -1- ifelse ->@w{ }
address@hidden
address@hidden example
address@hidden ignore
+
 @node Debug Levels
 @section Controlling debugging output
 
diff --git a/src/input.c b/src/input.c
index 18271cd..0d08215 100644
--- a/src/input.c
+++ b/src/input.c
@@ -472,6 +472,7 @@ push_token (token_data *token, int level, bool inuse)
             destructively modifies the chain it is parsing.  */
          chain = (token_chain *) obstack_copy (current_input, src_chain,
                                                sizeof *chain);
+         chain->next = NULL;
          if (chain->type == CHAIN_STR && chain->u.u_s.level == -1)
            {
              if (chain->u.u_s.len <= INPUT_INLINE_THRESHOLD || !inuse)
-- 
1.5.6.4


reply via email to

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