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

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

Re: [gawk-stable] bug: fatal error when getline from directory


From: Eric Blake
Subject: Re: [gawk-stable] bug: fatal error when getline from directory
Date: Sat, 03 Jan 2009 22:14:25 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Aharon Robbins on 1/3/2009 1:00 PM:
> 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.

POSIX 2008 states that awk is only required to operate on text files, and
a directory does not qualify as a text file:
http://www.opengroup.org/onlinepubs/9699919799/utilities/awk.html

Therefore, you can define gawk to do whatever you would like, as a
compliant client will never ask gawk to read a directory.

I recently changed GNU m4 to outright reject all attempts to open
directories as input files, printing an error message and exiting with
non-zero status after processing all other input files.  I just don't see
any other choice that is both sane and portable in how to handle directory
reads in any way that you could easily document, considering that systems
vary in whether you are even allowed to read from a file descriptor
visiting a directory.

http://lists.gnu.org/archive/html/m4-patches/2008-09/msg00004.html
http://git.savannah.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=4a5040d

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklgRbEACgkQ84KuGfSFAYDvNwCfVYeTtGKd6tzkJBYiUIQvk+dD
oDEAnjCPaedSYTEx5enTBMdt2sLvFmKf
=6e5v
-----END PGP SIGNATURE-----




reply via email to

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