bug-gnu-utils
[Top][All Lists]
Advanced

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

[PATCH] gawk: wide characters concatenation bug


From: Karel Zak
Subject: [PATCH] gawk: wide characters concatenation bug
Date: Fri, 10 Feb 2006 23:27:45 +0100

 Hi,

the version 3.1.5 has problem with wide characters concatenation. The
code in eval.c (Node_assign_concat part) reuse left part of the
expression, but it doesn't reset WSTRCUR flag. So function str2wstr()
doesn't work correctly on already forced string. It appears for example
when you use the 2x index() call:


$ (echo foo ; echo bar) | gawk '{a=$0; print index(a,"b"); getline; a = a $0; 
print index(a,"b")}'
0
0 <--- correct is 4 ('b' in 'foobar')


        Karel

---------------------

--- gawk-3.1.5/eval.c.wconcat   2006-02-10 22:45:26.000000000 +0100
+++ gawk-3.1.5/eval.c   2006-02-10 22:46:01.000000000 +0100
@@ -1176,6 +1176,7 @@
                        memcpy(l->stptr + l->stlen, r->stptr, r->stlen);
                        l->stlen += r->stlen;
                        l->stptr[l->stlen] = '\0';
+                       l->flags &= ~WSTRCUR;
                } else {
                        char *nval;
                        size_t nlen = l->stlen + r->stlen + 2;







reply via email to

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