[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug of gawk cvs version (builtin.c)
From: |
Aharon Robbins |
Subject: |
Re: bug of gawk cvs version (builtin.c) |
Date: |
Tue, 11 Mar 2008 22:52:08 +0200 |
This is indeed the right patch. The CVS repository will be updated
shortly with this fix, as well as the inclusion of libsigsegv.
Thanks!
Arnold
> From: Hirofumi Saito <address@hidden>
> Subject: bug of gawk cvs version (builtin.c)
> Date: Sun, 09 Mar 2008 03:24:26 +0900
> To: address@hidden
>
> 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.