2017-06-07 10:58:58 -0400, [email protected]:
> Applications can be written portably and are expected to take into  account 
> a generic <i>file</i> operand is '.' or '..' already;  readdir() may or may 
> not include '.'  or '..' values whenever a path  crosses a device mount 
> boundary. It may only have one or the other entries on  the media to report; 
> that is a file system design decision. As worded the  implication is if only 
> one is present, or none, that the other isn't to be  synthesized as a 
> separate dirent, or dirents, or merged with the one that  is present as a 
> dirent 
> extension. 
[...]

The text for readdir() has:

http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/functions/readdir.html

SUSv4TC2> If entries for dot or dot-dot exist, one entry shall be
SUSv4TC2> returned for dot and one entry shall be returned for
SUSv4TC2> dot-dot; otherwise, they shall not be returned.

It seems to clearly say that either both entries should be
returned or none.

My interpretation is that if only one of the two "exists", the
other one should be synthetized, though that definition of
"exists" is not necessarily clear. If it "exits" in the sense
that the "." or ".." path relative to them (as in
openat(dirfd(dir), ".")) resolves, then they always exist as
we've got a fd on the directory.

-- 
Stephane

Reply via email to