Web lists-archives.com

Re: dirent.d_type is not working on Cygwin symbolic links.

On Sun, Jan 29, 2017 at 8:34 PM, Thomas Wolff  wrote:
> Am 29.01.2017 um 20:17 schrieb waterlan:
>> Christian Franke schreef op 2017-01-29 12:15:
>>> waterlan wrote:
>>>> The dirent.d_type value for Cygwin symbolic links is 0 (DT_UNKNOWN). The
>>>> value is 10 (DT_LNK) for Windows native symbolic links. I think d_type
>>>> should be 10 for Cygwin symbolic links too.
>>> Sorry, no.
>>> The actual type should only be returned in dirent.d_type if the info
>>> is available at very low cost. This is not the case for Cygwin
>>> symbolic links.
>>> If DT_UNKNOWN is returned, lstat() must be called if type info is
>>> required.
>>> Quote from Linux man page readdir(3):
>>> "All applications must properly handle a return of DT_UNKNOWN."
>>> (https://linux.die.net/man/3/readdir)
>>> See also thread starting at:
>>> https://sourceware.org/ml/cygwin-patches/2008-q4/msg00000.html
>> In this case I do not agree with this. Cygwin symbolic links are there to
>> emulate Linux symlinks. Therefore I expect the same behaviour.
>> ``Cygwin is
>> * a large collection of GNU and Open Source tools which provide
>> functionality similar to a Linux distribution on Windows.''
>> (https://cygwin.com/)

similar != identical

> As you're quoting from the cygwin home page, you chose the wrong bullet.
> It's about tools while the functionality you are commenting about is
> provided by
>> * a DLL (cygwin1.dll) which provides substantial POSIX API functionality.
> So the reference here is POSIX, not Linux, if we're getting picky. And as
> Christian Franke had already quoted, the field in question is not mandatory
> at all by POSIX. So you'll have to do what other people also do: defensive
> programming, not expecting too much but taking all cases into account.

In other words, "all the world is not Linux".

GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple