[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug in Gawk 3.1.3-7 under Fedora Core 2
From: |
Aharon Robbins |
Subject: |
Re: Possible bug in Gawk 3.1.3-7 under Fedora Core 2 |
Date: |
Mon, 12 Jul 2004 15:48:03 +0300 |
Hi. Just to officially acknowledge this. As has already
been pointed out, you need to fix your program from
> { "dirname " $1 | getline DIRNAME
> "basename " $1 " .001" | getline BASENAME
to:
| { ("dirname " $1) | getline DIRNAME
| ("basename " $1 " .001") | getline BASENAME
This happens to be better practice, anyway. I'm sorry for the break with
backwards compatibility; the awk grammar is a rather complicated one,
and getting things to parse "correctly" all the time is difficult.
Also, re this:
> I'm a BIG fan of gawk and still use it inspite of the world's craze
> to deploy the latest and snazziest scripting language du jour to
> do everything.
Thanks!
> Sorting of dynamic arrays by hand is a bit cumbersome
> but I've gotten quite used to it, having written a quicksort in awk
> that really rips through the data.
Check out gawk's asort() and asorti() functions. They may do what you
need even more quickly, but at the cost of being gawk-specific.
Thanks,
Arnold
> Date: Fri, 09 Jul 2004 08:55:47 -0600
> From: Richard Nolde <address@hidden>
> Organization: Land Title Guarantee Company
> To: address@hidden
> Subject: Possible bug in Gawk 3.1.3-7 under Fedora Core 2
>
>
> Gawk Maintainers,
> I recently upgraded from Redhat 9 to Fedora Core 2 Linux and I
> discovered that the following shell script which calls gawk will
> no longer work. The version of awk that breaks is gawk 3.1.3-7
> and I have rebuilt it from the source RPM with no changes. If
> I substitute the version of awk (GNU Awk 3.1.1 Copyright (C) 1989,
> 1991-2002 Free Software Foundation.) that I have on my older RH9
> Linux installation, it works as expected. I have indicated the
> lines which fail at #### >>>>> <<<<<<<< #### in the snipnet
> below. The problems seems to be limited to the invocation of
> external commands that send their output to standard output to
> be captured by getline. Is this a return of the behavior which
> is described in the README.linux file?
>
> ls -l /dev/stdin
> lrwxrwxrwx 1 root root 17 Jul 7 09:52 /dev/stdin -> ../proc/self/fd/0
>
> ls -l /dev/stdout
> lrwxrwxrwx 1 root root 17 Jul 7 09:52 /dev/stdout -> ../proc/self/fd/1
>
> uname -a
> Linux zzz.xx.yy.com 2.6.6-1.435.2.3 #1 Thu Jul 1 08:25:29 EDT 2004 i686 i686
> i386 GNU/Linux
>
> Error Messages:
> ..
> Building consolidated files in /tmp/data
> sh: line 1: /cdrom/15/00600632.001: cannot execute binary file
> sh: line 1: .001: command not found
> Copying fileset /.* to /tmp/data/.tiff
> /.: Cannot read TIFF header.
> sh: line 1: /cdrom/15/00600633.001: cannot execute binary file
>
> # Bash Shell Script Extract
> ..
> SOURCE="/cdrom"
> DATADIR="/tmp/data"
> for DIR in `find ${SOURCE} -type d -print`
> do
> echo "Building consolidated files in ${DATADIR}"
> find ${DIR} -maxdepth 1 -type f -name "*.001" -print |
> awk -v DESTDIR=$DATADIR ' \
> { "dirname " $1 | getline DIRNAME
> "basename " $1 " .001" | getline BASENAME
> #### >>>>> The two previous lines appear to fail <<<<< #####
> WILDCARD = sprintf("%s/%s.*", DIRNAME, BASENAME)
> TIFFNAME = sprintf("%s/%s.tiff", DESTDIR, BASENAME)
> printf ("Copying fileset %s to %s\n", WILDCARD, TIFFNAME)
> system ("tiffcp -c g4 " WILDCARD " " TIFFNAME)
> close ("dirname" $1)
> close ("basename " $1 " .001")
> close ("tiffcp -c g4 " WILDCARD " " TIFFNAME)
> }'
> done
>
>
> I'm a BIG fan of gawk and still use it inspite of the world's craze
> to deploy the latest and snazziest scripting language du jour to
> do everything. Sorting of dynamic arrays by hand is a bit cumbersome
> but I've gotten quite used to it, having written a quicksort in awk
> that really rips through the data.
>
> Let me know if I can provide additional information that will help.
> I did the Fedora Core 2 install and pulled all available updates
> immediately. Googling for +gawk and +Fedora did not seem to find
> any references to this problem.
>
> Richard Nolde
> Systems Programmer
- Re: Possible bug in Gawk 3.1.3-7 under Fedora Core 2,
Aharon Robbins <=