[darcs-users] Handling relative directories
ganesh at earth.li
Fri Apr 2 10:44:26 UTC 2010
This is a followup to discussion on patch127 and issue1774, redirected to
The basic issue is that the darcs code makes use of the current working
directory, a process-level global. This is a significant issue for the
darcs library as it is not thread safe, either for concurrent calls to the
darcs library itself on different threads, or for concurrent use of CWD by
a non-darcs thread at the same time as darcs.
The obvious code fix is to use absolute paths anyway, but this
apparently has a significant performance penalty.
On Thu, 1 Apr 2010, Duncan Coutts wrote:
> Here's a crazy idea: use the POSIX "*at" functions, see man openat for
> an explanation and links to the related functions. The API can be
> emulated on Windows at the performance cost that has already been noted.
> The downside of course would be not using the ordinary System.*
> functions and having to write your own binding. Of course such a binding
> would be useful more widely, probably best as an implementation
> substrate in some new IO lib that has an abstract FilePath type.
Cool, thanks for the suggestion. I did run across openat when doing some
research on the problem, but I had mistakenly got the impression it was
only available on Solaris.
Doing a good job of the library won't be a quick job, but it sounds worth
doing if we can find someone willing :-) Any volunteers?
The other thing we should do is to benchmark the overhead of using
absolute paths and decide whether to expose the possibility of still using
CWD via either a compile-time or a runtime flag.
More information about the darcs-users