nix-super/src
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
..
build-remote Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
libcmd Merge pull request #9931 from 9999years/pretty-printer 2024-02-14 13:32:58 +01:00
libexpr Merge pull request #9985 from alois31/symlink-resolution 2024-02-16 09:24:03 -05:00
libfetchers Remove tarball-cache.{hh,cc} 2024-02-15 21:58:08 +01:00
libmain libexpr: Support structured error classes 2024-02-01 16:39:38 -08:00
libstore Merge pull request #10006 from edolstra/fix-impure-fetchurl 2024-02-13 22:50:55 +01:00
libutil Purify CanonPath 2024-02-16 09:47:25 -05:00
nix Proper parse and render functions for FileIngestionMethod and ContentAddressMethod 2024-02-13 10:30:16 -05:00
nix-build Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
nix-channel Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
nix-collect-garbage Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
nix-copy-closure Restrict some code to StoreDirConfig 2023-11-04 19:05:36 -04:00
nix-env Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
nix-instantiate Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
nix-store Merge pull request #9948 from obsidiansystems/no-canon-path-from-cwd 2024-02-12 14:04:01 +01:00
resolve-system-dependencies Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
toml11 Replace cpptoml with toml11 2021-12-17 22:03:33 +01:00