Issue 1774 darcs library is not thread-safe (uses current working directory)

Title darcs library is not thread-safe (uses current working directory)
Priority urgent Status needs-reproduction
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, duncan, ganesh, kowey, mornfall
Assigned To
Topics Library

Created on 2010-03-21.07:48:13 by ganesh, last changed 2010-04-02.10:48:17 by kowey.

msg10347 (view) Author: ganesh Date: 2010-03-21.07:48:09
The darcs code makes use of the current working directory, a process-
level  global. This 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 (see discussion on 
msg10622 (view) Author: ganesh Date: 2010-04-02.10:29:41
In msg10613, Duncan suggests use of the POSIX openat function where 

> 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.
msg10625 (view) Author: kowey Date: 2010-04-02.10:48:16
Discussion under way at

Hopefully this will give us an idea how to address the problem.

[Yeah, the downside to this separation of tracking from talking is the
bureaucratic overhead of talking about talking, and then apologetic
talking about talking about talking. Sorry! :-(]
Date User Action Args
2010-03-21 07:48:13ganeshcreate
2010-04-01 20:47:48ganeshlinkpatch127 issues
2010-04-02 10:29:41ganeshsetnosy: + duncan
messages: + msg10622
2010-04-02 10:32:21ganeshsettitle: darcs library is not thread-safe -> darcs library is not thread-safe (uses current working directory)
2010-04-02 10:48:17koweysetmessages: + msg10625