[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Regex problem with gawk 4.1.2
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] Regex problem with gawk 4.1.2 |
Date: |
Wed, 13 May 2015 16:30:01 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi Henrik,
On Wed, May 13, 2015 at 08:38:31PM +0200, Henrik Levkowetz wrote:
> One of my venerable awk programs, which I've tried to keep compatible with
> awk,
> nawk, and gawk for close to 15 years, suddenly broke when run with gawk 4.1.2.
>
> I've reduced the problem to the following little snippet. The problem seems
> to be with inclusion of an unquoted '[' character within the regex bracket
> expression, but not as the first character. According to the manual this
> should
> work [1], and it has indeed worked for me as long as I've worked with awk, but
> doesn't do so any more in 4.1.2:
>
> #!/opt/local/bin/gawk -f
> BEGIN {
> ref = ",";
> if (ref ~ /[,[]/) { print "whoo"; }
> }
>
> My copy of gawk 4.1.2 is running on OS X, version 10.9.5, installed with
> macports,
> and gives its version number as "GNU Awk 4.1.2, API: 1.1"
There is a regexp bracket parsing bug in gawk 4.1.2. It will be fixed in gawk
4.1.3. You can fetch a working version from the git repository gawk-4.1-stable
branch.
https://www.gnu.org/software/gawk/manual/html_node/Accessing-The-Source.html
Something like (off the top of my head):
git clone git://git.savannah.gnu.org/gawk.git gawk
cd gawk
git checkout gawk-4.1-stable
./bootstrap.sh && ./configure && make && make check && make install
Sorry for the trouble.
Regards,
Andy