hi Danny,
On Jul 23, 7:54am, Danny Cox wrote:
> Subject: Re: Anyone using XFS ACLs? (fwd)
> > ...
> > - trying to understand your '-D_FILE_OFFSET_BITS=64' problem -
> > I think we do need this, I just can't understand how this was
> > failing for you (can you give more details?) - I have a rh6.2
> > system here and it seems to work for the (limited) test cases
> > we tried.
>
> Okay, my /usr/include/dirent.h includes <bits/dirent.h>, in which I
> see:
>
> struct dirent
> {
> #ifndef __USE_FILE_OFFSET64
> __ino_t d_ino;
> __off_t d_off;
> #else
> __ino64_t d_ino;
> __off64_t d_off;
> #endif
> unsigned short int d_reclen;
> unsigned char d_type;
> char d_name[256]; /* We must not include limits.h! */
> };
>
> Compiling chacl.c WITH -D_FILE_OFFSET_BITS=64 gets me file names of
> "". Using gdb, I can see "..", and later on, the other file names.
> Compiling WITHOUT -D_FILE_OFFSET_BITS=64 gets me proper file names.
> Searching /usr/include for "__USE_FILE_OFFSET64" yields (among others),
> "features.h". It is features.h that contains the snippet:
>
> #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
> # define __USE_FILE_OFFSET64 1
> #endif
>
> Thus, I conclude that chacl.c is using a struct dirent whose size
> doesn't match (is larger than) what readdir(3) is returning, no?
>
There's another piece to the puzzle you may have missed - the
readdir syscall gets automagically remapped to readdir64 with
this flag ... from a very quick scan through libc, we should
be coming into the kernel via the getdents64 syscall, and we
should be using the right-sized data structure.
Do you have a reproducible test case under rh 6.2 which shows
the problem, so I could try it out? I can't get this to fail
on any machine, with a variety of distributions.
thanks.
--
Nathan
|