1
# Date: Mon, 27 Feb 2006 12:35:30 +0900
2
# From: KIMURA Koichi <kimura.koichi@canon.co.jp>
3
# Subject: gawk: sub_common has multi-byte aware bug
5
# Message-id: <20060227121045.2198.KIMURA.KOICHI@canon.co.jp>
9
# A certain user faced bug of sub builtin function and report to me.
10
# Then I investigated the bug.
12
# reproduce script is here.
15
str = "type=\"directory\" version=\"1.0\""
19
sub(/^[^=]*/, "", str);
22
sub(/^="[^"]*"/, "", str)
23
sub(/^[ \t]*/, "", str)
27
# and sample result is here (on GNU/Linux Fedora core 3)
29
# [kbk@skuld gawk-3.1.5]$ LC_ALL=C ./gawk -f subbug.awk
30
# "directory" version="1.0"
32
# [kbk@skuld gawk-3.1.5]$ LC_ALL=en_US.UTF-8 ./gawk -f subbug.awk
33
# "directory" version="1.0"
35
# [kbk@skuld gawk-3.1.5]$
37
# In my investigation, this bug is cause by don't release wide-string when
42
# --- builtin.c.orig 2005-07-27 03:07:43.000000000 +0900
43
# +++ builtin.c 2006-02-26 02:07:52.000000000 +0900
44
# @@ -2463,6 +2468,15 @@ sub_common(NODE *tree, long how_many, in
49
# + if (t->flags & WSTRCUR) {
50
# + if (t->wstptr != NULL)
54
# + t->flags &= ~WSTRCUR;
58
# if (matches > 0 && lhs) {
66
# #####################################################################################
67
# This Mail Was Scanned by 012.net AntiVirus Service1- Powered by TrendMicro Interscan