[Issue 6138] Using dirEntries and chdir() can have unwanted results

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 7 07:52:56 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=6138

--- Comment #4 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to RazvanN from comment #3)
> After analyzing the code I see that dirEntries does not call absolutePath on
> the path, which in my opinion is a bug. Even though I cannot reproduce the
> bug, I think a call to absolutePath should definitely be added

That might break things.

~ $ mkdir -p a/b/c
~ $ cd a/b/c
~/a/b/c $ touch a
~/a/b/c $ ls
a
~/a/b/c $ ls ~/a/b/c
a
~/a/b/c $ chmod 000 ~/a/b
~/a/b/c $ ls
a
~/a/b/c $ ls ~/a/b/c
ls: cannot access '/home/vladimir/a/b/c': Permission denied
~/a/b/c $ 

I think the correct solution would be to use fdopendir and openat (on POSIX).

--


More information about the Digitalmars-d-bugs mailing list