stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
99 stars 26 forks source link

Parallel runs of `pack` instances are not synronised and can lead to inconsistent state #278

Open buzden opened 8 months ago

buzden commented 8 months ago

Different instances of pack can change files inside $PACK_DIR. Sometimes, especially when there is a need of updating $PACK_DIR/.cache, they are trying to do same things on the same files.

We can try to synchronise some operations like caching and installing using file-system-based synchonisations. The most portable way that I know is mkdir. The most convenient way is flock, but I think it is available mostly on Linux machines.

Anyway, we need to think of the design of this, I mean how to determine when do we need to synchronise and at what granularity.