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

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

Re: bug in gawk/gsub() (not present in nawk)


From: Aharon Robbins
Subject: Re: bug in gawk/gsub() (not present in nawk)
Date: Sun, 8 Jun 2003 15:10:12 +0300

Greetings. Re this:

> Date: Thu, 5 Jun 2003 00:14:19 -0400 (EDT)
> From: Jose Nazario <address@hidden>
> To: address@hidden, address@hidden,
>    address@hidden
> Subject: bug in gawk/gsub() (not present in nawk)
>
> while playing with some tools in data massaging, i had to migrate from an
> openbsd/nawk system to a netbsd/gawk system. i found the folllowing
> behavior, which seems to be a bug.
>
> the following gsub() pattern has a strange effect under gawk which is not
> visible in nawk (at least as compiled on openbsd). the intention is to
> take a string like "This Is a Title: My Title?" and turn it into a
> normalized string: "ThisIsaTitleMyTitle". to do this, i wrote the
> following gross gsub line in an awk script:
>
>       gsub(/[\ \"-\/\\:;address@hidden,\$]/, "", $2)
>       print $2
>
> in gawk, as found in netbsd-macppc/1.5.2, this will drop the first letter
> of every word. the resulting string will be "hissitleyitle", while in nawk
> as built on openbsd-3.3 this will get it correct.
>
> any insights? the inconsistency with this relatively naive pattern seems a
> bit odd. (i would up installing nawk built from openbsd sources.)
>
> thanks. sorry i didn't send a better bug report, netbsd folks, i'm not
> much of a netbsd user, and i dont have send-pr set up. yes, this is a
> slightly older version of netbsd and gawk:
>
> $ uname -a
> NetBSD entropy 1.5.2 NetBSD 1.5.2 (GENERIC) #0: Sun Feb 10 02:00:04 EST
> 2002     address@hidden:/usr/src/sys/arch/macppc/compile/GENERIC macppc
> $ awk --version
> GNU Awk 3.0.3
> Copyright (C) 1989, 1991-1997 Free Software Foundation.
>
> thanks.
> ___________________________
> jose nazario, ph.d.                   address@hidden
>                                       http://monkey.org/~jose/

As mentioned by other people, this is a very old version of gawk.  This bug
does not appear in the current gawk (3.1.2).  Unfortunately, current gawk has
some other bugs; I hope to have 3.1.3 out "soon".

In the meantime, I'll add this as a test case to the gawk test suite.

Thanks,

Arnold




reply via email to

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