Because of the 'dot or dot-dot', not 'dot and dot-dot', I  construe 'they' 
as "one or the other, or both if both missing" shall not be  returned. You 
don't synthesize an unnamed or assigned name record for one that  isn't 
present, to relate it to rest of paragraph. This may be off, I can see why  you 
feel the way you do, but it is consistent with the -a and -A  descriptions 
for ls. Both or none only isn't.
 
 
In a message dated 6/7/2017 11:47:04 A.M. Eastern Daylight Time,  
stephane.chaze...@gmail.com writes:

2017-06-07 10:58:58 -0400, shwares...@aol.com:
> Applications  can be written portably and are expected to take into  acco
unt 
> a  generic file 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/readdi
r.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