[PATCH] glob: Simplify the interface for the GLOB_ALTDIRFUNC callback gl_readdir
Florian Weimer
fweimer@redhat.com
Mon Apr 11 16:57:00 GMT 2016
On 04/08/2016 08:44 PM, Roland McGrath wrote:
> This is a potentially breaking ABI and API change. The documentation does
> not say anything specific about what the gl_readdir function's protocol is.
> It just says "an alternative implementation of readdir". The way I'd read
> that, and the reality of the status quo ante, is that a trivial wrapper
> around readdir will behave identically to not using GLOB_ALTDIRFUNC at all.
> That means that d_ino==0 results must be ignored.
>
> IMHO this means we need symbol versioning to make a change to the treatment
> of d_ino.
I'm trying to get clarification if getdents on Linux can ever return
zero d_ino values. It's going to be difficult to work this out due to
the VFS layer. My hunch is that inode 0 is more likely to mean “I can't
tell you the inode number right now here”, and not “please skip this entry”.
In a sense, with glob64, supplying readdir64 as the callback does not
actually change behavior if the d_ino == 0 is left out because that
readdir64 implementation would not be POSIX-compliant (d_ino has to be
the file serial number if the member exists).
I think we have to filter in readdir in order to comply with POSIX if
the alleged historic race (d_ino is 0 during removal) can happen on
Linux or Hurd.
> It's a sufficiently conservative change to start ignoring d_namlen,
> so you could do that separately.
Indeed, this should be a different conversation. I tried to word the
new documentation in a way that leaves the door open for that.
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-glob-Simplify-the-interface-for-the-GLOB_ALTDIRFUNC-.patch
Type: text/x-patch
Size: 6762 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160411/a068ab0f/attachment.bin>
More information about the Libc-alpha
mailing list