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

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

Re: Bug w/ gawk stat extension


From: Jim Meyering
Subject: Re: Bug w/ gawk stat extension
Date: Wed, 22 Jun 2005 23:31:44 +0200

"Andrew J. Schorr" <address@hidden> wrote:
> On Wed, Jun 22, 2005 at 08:45:28PM +0200, Jim Meyering wrote:
>> IMHO, the best way to read a link name is to call readlink in a loop.
>> If you roll your own, beware that st_size is sometimes not at all
>> related to the length of the link name.
>
> Hmmm, is that true?  According to the Single Unix Spec at
>
>    http://www.opengroup.org/onlinepubs/009695399/functions/lstat.html
>
> "The value returned in the st_size member is the length of the contents of
> the symbolic link, and does not count any trailing null."

It'd be great if every system adhered to the spec,
assuming it's always well defined :), but they don't,
so we have tools like autoconf and gnulib.

> Are there platforms where this does not hold?  Does Windoze behave
> differently?  Are there unix-type platforms where st_size is not
> the link length?

I didn't find an account of exactly what I remembered (where
st_size was totally bogus), but at least Cygwin has had invalid
st_size for symlinks as recently as 2004:

  http://permalink.gmane.org/gmane.os.cygwin.patches/1701




reply via email to

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