A globally-available filesystem prevents access tracing

Last edited April 2021
Backlinks: The filesystem is global mutable state

Tracing filesystem access is useful to figure out what a certain part of a program does, and taking actions based on that, such as creating a file dependency graph.

Tracing filesystem access can only be done when the filesystem is not globally available. Otherwise, filesystem access tracing cannot be done reliably when multiple parts of a program access the filesystem in parallel.

Making the filesystem not globally available, and instead passing in the filesystem as a reference, would make this possible.

Impact on Nanoc

For Nanoc, this is problematic because some filters do their own filesystem access, which Nanoc cannot trace, and therefore Nanoc cannot build the right dependencies.

How other tools handle this issue

The tup build system uses FUSE to spin up a filesystem, which is globally available, but allows tracing because tup is fully responsible for the filesystem.

Bazel requires dependencies to be stated explicitly (thus eliminating the need for access tracing) and supports sandboxing to enforce correctness of these dependency declarations.