[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug of gawk cvs version (builtin.c)
From: |
Hirofumi Saito |
Subject: |
bug of gawk cvs version (builtin.c) |
Date: |
Sun, 09 Mar 2008 03:24:26 +0900 |
User-agent: |
Wanderlust/2.15.5 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.7 Emacs/22.1 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) |
Hello.
I checked out the latest cvs version of gawk from savannah at
2008-03-08.
But printf() function formatted by "%c" is something strange in my
Fedora8 (ja_JP.UTF-8).
(1) gawk 'BEGIN{printf "%c\n", 65}'
This code is same as a sample code of gawk.info.
But the result is "gawk: builtin.c:1177: format_tree: Assertion `cp ==
arg->sub.val.sp'".
(2) gawk 'BEGIN{printf "%c\n", "AA"}'
The result is "AA".
The expected answer is just "A".
The simple patch for this bug is provided by Koichi Kimura.
--- builtin.c.orig 2008-03-07 04:50:40.000000000 +0900
+++ builtin.c 2008-03-09 02:14:09.562500000 +0900
@@ -1175,7 +1195,8 @@ check_pos:
copy_count = prec;
if (gawk_mb_cur_max > 1 && (cs1 == 's' || cs1 == 'c')) {
assert(cp == arg->stptr);
- copy_count = mbc_byte_count(arg->stptr,
arg->stlen);
+ copy_count = mbc_byte_count(arg->stptr,
+ cs1=='s' ?
arg->stlen : 1);
}
bchunk(cp, copy_count);
while (fw > prec) {
After applying this patch, it goes well and Japanese charactors are
processed correctly too.
Regards,
Hirofumi.
- bug of gawk cvs version (builtin.c),
Hirofumi Saito <=