[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: |
Eric Blake |
Subject: |
Re: [gawk-stable] bug: fatal error when getline from directory |
Date: |
Sun, 04 Jan 2009 16:59:47 -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 Paolo on 1/4/2009 4:30 PM:
> please define 'human-readable'.
> POSIX 'text file' is any sequence of chars except for '\0', in 1+ lines
> shorter than LINE_MAX, which is OS/implementation-specific.
And one more requirement - the file must end in a newline. Ending in any
other byte makes the file non-text.
> So you may well
> have a 'text file' which isn't that 'human-readable' at all.
Yes, that is true.
>
> *I* might agree that dirs aren't "text" nor "binary" files, yet you can
> open(2)+read(2) a dir without a glitch - you get an EOF.
Not necessarily. That is the behavior on some OS, but not all. Some
platforms don't even allow open(2) on directories (think mingw), although
that violates POSIX; within the realm of POSIX, you also have the three
behaviors after the open(2) succeeds: the read(2) fails with EISDIR (think
Linux), it succeeds with 0 bytes (your report of EOF, think BSD), or it
succeeds with non-zero bytes (raw reading which can generally be overlaid
to a struct dirent; think BeOS or older Unix).
> But that's not the point.
Exactly. The point is that the only portable choice that we can implement
and document across all platforms is to fail on attempts to read a
directory, even if the OS would otherwise allow it.
- --
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
iEYEARECAAYFAklhTXMACgkQ84KuGfSFAYAI3QCgl8JEYGF+edLCUrWTO9fxx+jN
15AAn0Xd3Z48Zrf69kQNO/XT32+hfAU7
=hKhe
-----END PGP SIGNATURE-----
- Re: [gawk-stable] bug: fatal error when getline from directory, (continued)
- 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
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 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,
Eric Blake <=
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Andrew J. Schorr, 2009/01/05
- Re: [gawk-stable] bug: fatal error when getline from directory, John Cowan, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Eli Zaretskii, 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/05
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/05
- Re: [gawk-stable] bug: fatal error when getline from directory, Andrew J. Schorr, 2009/01/05
Re: [gawk-stable] bug: fatal error when getline from directory, Aharon Robbins, 2009/01/03
Re: [gawk-stable] bug: fatal error when getline from directory, Aharon Robbins, 2009/01/03