bug-glibc
[Top][All Lists]
Advanced

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

Re: tw() not correctly handling symlinks


From: Michael Kerrisk
Subject: Re: tw() not correctly handling symlinks
Date: Wed, 1 Aug 2001 11:00:51 +0200

> "Michael Kerrisk" <address@hidden> writes:
> 
> > In what circumstances (if any) will/should glibc:ftw() pass FTW_SL as a
> > value to flag?  
> 
> If you'd taken a look at the sources you'd seen the only nftw() ever
> returns FTW_SL.

I HAVE looked at the source.  Clearly ftw() never returns FTW_SL.  (So 
"will/should" above should really have just be "should")  That is the 
whole point.  My question / contention is whether or not there are 
circumstances when ftw() *should* pass FTW_SL.  The Austin::ftw() repeats 
the same text from SUSv2::ftw(), about the values that ftw() may return:

*****
FTW_D For a directory. 

FTW_DNR For a directory that cannot be read. 

FTW_F For a file. 

FTW_SL For a symbolic link (but see also FTW_NS below). 

FTW_NS For an object other than a symbolic link on which stat() could not 
successfully be executed. If the object is a symbolic link and stat() 
failed, it is unspecified whether ftw() passes FTW_SL or FTW_NS to the 
user-supplied function. 
*****

Now bear in mind that this is the text ftw() not nftw() (In passing: I 
assume a typo on your part since I've never mentioned nftw(), which can of 
course return FTW_SL).  My reading of this is that therefore ftw() should 
pass FTW_SL for a symlink.  The people at Digital-OSF / Compaq-Tru64 seem 
also to view things this way.  Solaris seeems to think more along the same 
lines you do.

I am not (necessarily) trying to prove a bug.  One or other of us is 
misreading the standards (I contend because they're not so clear) or 
perhaps they're loose enough to accommodate both views.  

So to reiterate: my question is do you think there are ever circumstances 
in which ftw() should pass FTW_SL?  (And if not, then given the FTW_SL 
appears in the SUS::ftw() spec, why not?)

Cheers

Michael
__________________________________________
Michael Kerrisk
mailto: address@hidden



reply via email to

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