bug-gnulib
[Top][All Lists]
Advanced

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

Re: xreadlink.c initial buffer size guesstimate


From: Eric Blake
Subject: Re: xreadlink.c initial buffer size guesstimate
Date: Sat, 13 Jan 2007 17:57:24 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666

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

According to Liyang HU on 1/13/2007 4:48 PM:
> On Fri, Jan 12, 2007 at 08:30:24AM -0700, Eric Blake wrote:
>> why should you expect sane behavior from tools that assume POSIX?
> 
> If xreadlink() assumed POSIX, it would allocate a fixed buffer of 256 bytes.

Wrong.  POSIX guarantees that you will have AT LEAST 256, but allows you
to allocate much more (and some systems, such as GNU Hurd, have the goal
of allowing as much as you would like).

> I'm not even sure my toy FS violates POSIX. st_size contains the /on-disk/
> size of the symlink, not the length of the symlink in bytes.

http://www.opengroup.org/onlinepubs/009695399/functions/lstat.html
"For symbolic links, ... the st_size member shall contain the length of
the pathname contained in the symbolic link."

Your FS flat out violates this rule.

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

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

iD8DBQFFqX/z84KuGfSFAYARAtuSAKCdmK3VgWQC4oC7ijix9wFOk9YRLwCgttgu
GDH5TWuNkoYeF8jXw9gER38=
=Znhy
-----END PGP SIGNATURE-----




reply via email to

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