Re: xreadlink.c initial buffer size guesstimate

2007-01-16 Thread Liyang HU
On Sat, Jan 13, 2007 at 05:57:24PM -0700, Eric Blake wrote: > According to Liyang HU on 1/13/2007 4:48 PM: > > If xreadlink() assumed POSIX, it would allocate a fixed buffer of 256 bytes. > Wrong. POSIX guarantees that you will have AT LEAST 256, [...] You are absolutely right. > > I'm not even

Re: xreadlink.c initial buffer size guesstimate

2007-01-14 Thread Liyang HU
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. > By violating that rule of POSIX, the bug is squarely on your FS's shoulders, I'm not even

Re: xreadlink.c initial buffer size guesstimate

2007-01-13 Thread Eric Blake
-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 b

Re: [bug-gnulib] xreadlink.c initial buffer size guesstimate

2007-01-12 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes: > in the frequent case that the link is smaller than 1024 and that the > guess was right, both implementations call xmalloc just once. Thanks. I installed the following to make it more robust for this case. 2007-01-12 Paul Eggert <[EMAIL PROTECTED]>

Re: [bug-gnulib] xreadlink.c initial buffer size guesstimate

2007-01-12 Thread Bruno Haible
Liyang HU wrote: > I've been getting ``ls: memory exhausted'' messages, which I eventually > tracked down to xreadlink() attempting to allocate several hundred MB of > memory, since that's what lstat() returns[0] for the symlink's st_size. > In actuality, the length of the symlink were mostly under

Re: xreadlink.c initial buffer size guesstimate

2007-01-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Liyang HU on 1/11/2007 6:29 PM: > > [0] I know, lstat() should report the on-disk usage of the symlink; however > I thought of more nefarious uses for st_size. Consider my FS braindead if > you will, but xreadlink() needn't fail... Sorry

xreadlink.c initial buffer size guesstimate

2007-01-12 Thread Liyang HU
Hallo, I've been getting ``ls: memory exhausted'' messages, which I eventually tracked down to xreadlink() attempting to allocate several hundred MB of memory, since that's what lstat() returns[0] for the symlink's st_size. In actuality, the length of the symlink were mostly under 128 bytes. It s