www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Bug in std.file.exists under linux

The Linux version of std.file.exists has been changed to:

return access(toStringz(name),0) != 0;

This is incorrect at least on my system. The glibc documentation says for  

"The return value is 0 if the access is permitted, and -1 otherwise. (In  
other words, treated as a predicate function, access returns true if the  
requested access is denied.)"

A similar definition can be found on www.opengroup.org. Thus the line has  
to be changed to:

return access(toStringz(name),0) == 0;

This bug does also break Build from Derek, which complains about missing  
build.brf and similar files, because the previous existance test does not  
work. That's how i discovered it. I have already changed the line in my  
Phobos, recompiled (i had to remove recls from the build, as it produced a  
lot of errors, by the way) and everything works perfect.

Aug 09 2005