Why doesn't std.file.exists follow symbolic links?
jfondren
julian.fondren at gmail.com
Fri Jul 2 15:57:08 UTC 2021
On Friday, 2 July 2021 at 15:30:43 UTC, Jack Applegame wrote:
> I am a "naive user" of `exists()` in production and have not
> encountered any problems with it.
OK, let's add a third category:
1. someone who uses exists() without an awareness of race
conditions.
(I argue this person has more to worry about than symlink
resolution.)
2. someone who uses exists() with an acceptance of race
conditions, but whose
familiarity with similar functionality from other languages
results in an
unpleasant surprise with D.
(I argue that this is a documentation problem. Incidentally,
stuff like
https://github.com/dlang/phobos/blob/master/std/file.d#L1957
should really just
be in the generated phobos docs. That's useful information and
very much
like the topic at hand. Perhaps there are also people who
expected exists()
to be implemented with access)
3. someone who distrusts these abstractions of the POSIX API and
therefore
doesn't use them without confirming exactly how they're
implemented.
(I've offended you by presenting this as the "non-naive"
counterpoint to #1.)
More information about the Digitalmars-d
mailing list