1
# Date: Thu, 27 Apr 2006 20:59:03 +0100
2
# From: Lee Haywood <ljhaywood2@googlemail.com>
3
# Subject: gawk multi-byte support bugs, assertion bug and fix.
5
# Message-id: <60962be00604271259na0d8fdayb9d0c69a853216e8@mail.gmail.com>
7
# Content-type: multipart/alternative;
8
# boundary="----=_Part_10136_920879.1146167943492"
11
# ------=_Part_10136_920879.1146167943492
12
# Content-Type: text/plain; charset=ISO-8859-1
13
# Content-Transfer-Encoding: quoted-printable
14
# Content-Disposition: inline
17
# Firstly, I have been getting the following error from version 3.1.5.
19
# awk: node.c:515: unref: Assertion `(tmp->flags & 4096) !=3D 0' failed.
21
# In mk_number() in node.c the MBS_SUPPORT code is inside the GAWKDEBUG
22
# section - moving it outside explicitly clears the string values, which
23
# prevents the assertion error from occurring. The corrected version is
24
# shown at the end of this message.
26
# As an aside, I also noticed that n->wstptr is not cleared by
27
# set_field() and set_record() in field.c when the flags are set to
28
# exclude WSTRCUR. However, I do not have a test case to show if
29
# changing them makes any difference.
31
# A second problem also occurs when gawk 3.1.5 is compiled with
32
# multi-byte character support (MBS_SUPPORT). The following code should
33
# change the index of the substring "bc" from 2 to 3, but it gets
34
# reported as 2 in both cases - which is obviously disastrous.
39
# print "Before <" Value "> ",
40
# index( Value, "bc" )
42
# sub( /bc/, "bbc", Value )
44
# print "After <" Value ">",
45
# index( Value, "bc" )
48
# Compiling with MBS_SUPPORT undefined makes these problems go away.
50
# /* mk_number --- allocate a node with defined number */
53
# mk_number(AWKNUM x, unsigned int flags)
58
# r->type =3D Node_val;
61
# #if defined MBS_SUPPORT
64
# #endif /* MBS_SUPPORT */
69
# #if defined MBS_SUPPORT
70
# r->flags &=3D ~WSTRCUR;
71
# #endif /* MBS_SUPPORT */
72
# #endif /* GAWKDEBUG */
84
print "Before <" Value "> ", index( Value, "bc" )
86
sub( /bc/, "bbc", Value )
88
print "After <" Value ">", index( Value, "bc" )