[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gawk-stable] bug: fatal error when getline from directory
From: |
Aharon Robbins |
Subject: |
Re: [gawk-stable] bug: fatal error when getline from directory |
Date: |
Sat, 03 Jan 2009 22:00:50 +0200 |
Greetings. Re this:
> Date: Thu, 01 Jan 2009 21:18:29 +0100
> To: address@hidden
> CC: James Troup <address@hidden>, Paolo <address@hidden>
> Subject: [gawk-stable] bug: fatal error when getline from directory
>
> Happy New Year Arnold,
>
> I want to inform you about a bug in gawk-stable (current CVS version)
> and in earlier versions which Paolo has reported to the Debian
> bug-tracking system. (The current Debian gawk-maintainer is James
> Troup.)
> I
> Look at:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=407454
>
> If you like it, I write a patch versus gawk-stable (according your
> advices.)
>
> I think the suggestions of Paolo are the right way.
> --
> Steffen
I have to decide what "the right thing" is here. Just to close the loop
w/o needing to look at the Debian file, the reported problem is that
getline from a directory is fatal, instead of an error.
Different awks do different things when handed a directory. Brian
Kernighan's awk treats a read of a directory as EOF; I think that's wrong.
For example:
$ for i in nawk mawk mksawk gawk
> do echo ==== $i
> $i 'BEGIN { x = 4; print (getline x < "/tmp") ; print x }'
> done
==== nawk
0
4
==== mawk
mawk: read error (Is a directory)
==== mksawk
-1
==== gawk
gawk: fatal: file `/tmp' is a directory
In the same vein, each awk behaves differently when given a
directory on the command line. BWK awk and mksawk (used in Solaris
as /usr/xpg4/bin/awk) ignore the directory, mawk gives an error, as
does gawk:
$ for i in nawk mawk mksawk gawk
> do echo ==== $i
> $i '{ print FILENAME }' a /tmp b
> done
==== nawk
a
b
==== mawk
a
mawk: read error (Is a directory)
==== mksawk
a
b
==== gawk
a
gawk: (FILENAME=a FNR=1) fatal: cannot open file `/tmp' for reading
(Success)
I will consult with the other awk authors before I decide what to do.
Thanks,
Arnold
- [gawk-stable] bug: fatal error when getline from directory, Steffen Schuler, 2009/01/01
- Re: [gawk-stable] bug: fatal error when getline from directory,
Aharon Robbins <=
- Re: [gawk-stable] bug: fatal error when getline from directory, John Cowan, 2009/01/03
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/03
- Re: [gawk-stable] bug: fatal error when getline from directory, Eric Blake, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Eric Blake, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Andreas Schwab, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Eric Blake, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/05
- Re: [gawk-stable] bug: fatal error when getline from directory, Eli Zaretskii, 2009/01/04