RedPRL / bantorra

📚 A library for managing libraries and resolving unit paths
https://redprl.org/bantorra/bantorra
Apache License 2.0
17 stars 0 forks source link

Use Unix.realpath (via OCaml 4.13) and avoid Unix.chdir #53

Closed favonia closed 2 years ago

favonia commented 3 years ago

Unix.chdir and Sys.getcwd are currently used to normalize file paths, but the stateful chdir becomes a major reason why bantorra is not thread-safe. It's possible to normalize file paths without chdir, but the code would be too ugly. Thankfully, OCaml 4.13 will bring in a real Unix.realpath that does the job. I believe with some locking the entire library can be made thread-safe. For these reasons we should switch to OCaml 4.13 as soon as it is officially released.