darcs

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

Title darcs library is not thread-safe (uses current working directory)
Priority wishlist Status unknown
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 2020-08-01.16:18:10 by ganesh.

Messages
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 
patch127).
msg10622 (view) Author: ganesh Date: 2010-04-02.10:29:41
In msg10613, Duncan suggests use of the POSIX openat function where 
available:

> 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
http://lists.osuosl.org/pipermail/darcs-users/2010-April/023566.html

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! :-(]
msg22349 (view) Author: bfrk Date: 2020-08-01.10:23:42
Marking this as "wishlist". I am not sure any of the proposed 
solutions are practical. openat is nice but not available via the 
Win32 API (https://stackoverflow.com/questions/32138524/is-there-a-
windows-equivalent-of-openat).
msg22365 (view) Author: ganesh Date: 2020-08-01.16:18:07
I agree this should be wishlist for now but it would be very nice to find a
proper solution. I'd be open to using the NT kernel API (NtCreateFile)
if necessary.
History
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
2020-08-01 10:23:46bfrksetpriority: urgent -> wishlist
status: needs-reproduction -> (no value)
messages: + msg22349
2020-08-01 16:18:10ganeshsetstatus: unknown
messages: + msg22365