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

Re: For those who care about pam-ssh: RFC

On Wed, Dec 17, 2008 at 2:11 AM, Bastien ROUCARIES
<roucaries.bastien@gmail.com> wrote:
> On Wed, Dec 17, 2008 at 12:57 AM, Steve McIntyre <steve@einval.com> wrote:
>> Luca wrote:
>>>2008/12/16 Luca Niccoli <lultimouomo@gmail.com>:
>>>> I can't really see what I'm doing wrong...
>>>Maybe I have a clue:
>>>++file_filter(const struct dirent *dir)
>>>++      return (DT_REG == (DT_REG & dir->d_type)) ||
>>>++             (DT_LNK == (DT_LNK & dir->d_type)) ;
>>>But I use XFS, which seems to have some problems with d_type [1]
>>>I'm not really sure this is the source of the problem, but I thought
>>>it was worth giving a try...
> Reading the man page of readdir you should alway test for DT_UNKNOWN,
> and fallback to stat
> if DT_UNKNOWN is set. And you should guard this test by #ifdef

> Moreover if you read getdents manpage, you will read that d_type is
> only filled since 2.6.4! In all the case I think we need to open a bug
> for getdents manpage it does not specify that d_type is DT_UNKNOW
> before 2.6.4 (backward compatibilty). I will fill a bug report.

I should add that man page specify that DT_UNKNOW should be handled
see  http://www.kernel.org/doc/man-pages/online/pages/man2/getdents.2.html

> Perhaps filling a bug to manpage will be appropriate because wording
> is not clear.
> Please beware that they are issue with link and directory. Like for instance in
> http://mail.kde.org/pipermail/kdelibs-bugs/2008-March/001006.html
> d_type is an optimization not a thing that alway work.
> Bastien
>> I don't know about the exact state today, but at least in the past
>> many filesystems have not filled in d_type in readdir() calls. If you
>> want to see the type of a filesystem object safely and portably,
>> you'll need to call stat() or similar on each file.
>> --
>> Steve McIntyre, Cambridge, UK.                                steve@einval.com
>>  Mature Sporty Personal
>>  More Innovation More Adult
>>  A Man in Dandism
>>  Powered Midship Specialty
>> --
>> To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
>> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: