nix/tests/unit
John Ericson d17e1d9737 Purify CanonPath
The core `CanonPath` constructors were using `absPath`, but `absPath` in
some situations does IO which is not appropriate. It turns out that
these constructors avoided those situations, and thus were pure, but it
was far from obvious this was the case.

To remedy the situation, abstract the core algorithm from `canonPath` to
use separately in `CanonPath` without any IO. No we know by-construction
that those constructors are pure.

That leaves `CanonPath::fromCWD` as the only operation which uses IO /
is impure. Add docs on it, and `CanonPath` as a whole, explaining the
situation.

This is also necessary to support Windows paths on windows without
messing up `CanonPath`. But, I think it is good even without that.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-02-16 09:47:25 -05:00
..
libexpr Merge pull request #9931 from 9999years/pretty-printer 2024-02-14 13:32:58 +01:00
libexpr-support Only link with -pthread on Unix 2024-01-10 20:38:39 -05:00
libstore Proper parse and render functions for FileIngestionMethod and ContentAddressMethod 2024-02-13 10:30:16 -05:00
libstore-support test: Generate distinct path names 2024-01-31 18:35:19 +01:00
libutil Purify CanonPath 2024-02-16 09:47:25 -05:00
libutil-support test: Generate distinct hashes 2024-01-31 18:35:19 +01:00