1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-02 05:11:47 +02:00
nix/src/libutil
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
..
args Fix nix shebang interaction with #8131 overhaul completions 2023-11-07 13:24:01 -05:00
signature Signer infrastructure: Prep for #9076 2024-01-03 16:13:55 -05:00
abstract-setting-to-json.hh Make toJSONObject const 2023-11-06 16:00:25 +01:00
ansicolor.hh Finish converting existing comments for internal API docs (#8146) 2023-04-07 13:55:28 +00:00
archive.cc Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
archive.hh ParseSink -> FileSystemObjectSink 2024-01-22 18:01:18 -05:00
args.cc Fix formatting of hash args 2024-01-29 17:50:25 +01:00
args.hh Start standardizing hash algo flags 2024-01-20 17:29:35 -05:00
callback.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
canon-path.cc Purify CanonPath 2024-02-16 09:47:25 -05:00
canon-path.hh Purify CanonPath 2024-02-16 09:47:25 -05:00
cgroup.cc Separate SystemError from SysError 2024-01-12 12:00:33 -05:00
cgroup.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
chunked-vector.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
closure.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
comparator.hh use std::tie() for macro-generated operators 2023-12-19 19:32:16 +01:00
compression.cc Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
compression.hh Rename and protect BufferedSink::write 2023-04-07 09:21:50 +02:00
compute-levels.cc Add x86_64 compute levels as additional system types 2021-02-22 09:11:15 +01:00
compute-levels.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
config-impl.hh Fix moves in appendOrSet 2023-11-06 16:00:25 +01:00
config.cc Separate SystemError from SysError 2024-01-12 12:00:33 -05:00
config.hh Merge pull request #9233 from bouk/bouk/apply-config-inner 2023-12-01 08:23:32 -05:00
current-process.cc Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
current-process.hh Add missing #include for rlim_t 2024-01-26 22:34:31 -05:00
english.cc Unify and refactor value printing 2024-01-11 16:34:36 -08:00
english.hh Unify and refactor value printing 2024-01-11 16:34:36 -08:00
environment-variables.cc Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
environment-variables.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
error.cc Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
error.hh Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
experimental-features.cc reword description for the fetch-tree experimental feature 2023-12-04 16:42:32 +01:00
experimental-features.hh Add the MountedSSHStore experimental feature 2023-11-21 13:16:46 -05:00
file-content-address.cc Update src/libutil/file-content-address.cc 2024-02-13 12:50:10 -05:00
file-content-address.hh Proper parse and render functions for FileIngestionMethod and ContentAddressMethod 2024-02-13 10:30:16 -05:00
file-descriptor.cc Remove C-style casts 2024-01-16 17:00:46 +00:00
file-descriptor.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
file-path-impl.hh Purify CanonPath 2024-02-16 09:47:25 -05:00
file-system.cc Purify CanonPath 2024-02-16 09:47:25 -05:00
file-system.hh absPath: just take a std::string_view 2024-01-15 08:21:54 -05:00
finally.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
fmt.hh Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
fs-sink.cc CanonPath, SourcePath: Change operator + to / 2024-02-05 15:17:39 +01:00
fs-sink.hh Split GitRepoImpl::importTarball 2024-02-15 10:27:54 -05:00
git.cc CanonPath, SourcePath: Change operator + to / 2024-02-05 15:17:39 +01:00
git.hh Improve the FileSystemObjectSink interface 2024-01-22 18:01:21 -05:00
hash.cc Signer infrastructure: Prep for #9076 2024-01-03 16:13:55 -05:00
hash.hh Signer infrastructure: Prep for #9076 2024-01-03 16:13:55 -05:00
hilite.cc Fix incorrect comment in hiliteMatches 2022-06-05 20:30:18 +02:00
hilite.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
input-accessor.hh Combine AbstractPos, PosAdapter, and Pos 2024-01-08 10:59:41 -08:00
json-impls.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
json-utils.cc Fix derivation load assertion errors 2023-08-05 01:34:30 +02:00
json-utils.hh fix: nlohmann::adl_serializer for std::optional (#9147) 2023-11-30 01:26:39 +00:00
local.mk Only link with -pthread on Unix 2024-01-10 20:38:39 -05:00
logging.cc libexpr: Support structured error classes 2024-02-01 16:39:38 -08:00
logging.hh Cleanup fmt.hh 2024-02-08 11:51:03 -08:00
lru-cache.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
memory-source-accessor.cc Improve the FileSystemObjectSink interface 2024-01-22 18:01:21 -05:00
memory-source-accessor.hh Improve the FileSystemObjectSink interface 2024-01-22 18:01:21 -05:00
monitor-fd.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
namespaces.cc Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
namespaces.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
pool.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
position.cc Combine AbstractPos, PosAdapter, and Pos 2024-01-08 10:59:41 -08:00
position.hh Combine AbstractPos, PosAdapter, and Pos 2024-01-08 10:59:41 -08:00
posix-source-accessor.cc Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
posix-source-accessor.hh Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
processes.cc Remove C-style casts 2024-01-16 17:00:46 +00:00
processes.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
ref.hh Combine AbstractPos, PosAdapter, and Pos 2024-01-08 10:59:41 -08:00
references.cc Renamed HashFormat::Base32 to HashFormat::Nix32 2023-12-06 23:43:42 +01:00
references.hh HashType: Rename to HashAlgorithm 2023-12-06 23:43:42 +01:00
regex-combinators.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
repair-flag.hh Combine AbstractPos, PosAdapter, and Pos 2024-01-08 10:59:41 -08:00
serialise.cc Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
serialise.hh Use BackedStringView 2024-01-18 15:27:57 +01:00
signals.cc Don't use std::make_unique right before release 2024-01-16 17:00:46 +00:00
signals.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
source-accessor.cc HashType: Rename to HashAlgorithm 2023-12-06 23:43:42 +01:00
source-accessor.hh Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
source-path.cc Merge pull request #9985 from alois31/symlink-resolution 2024-02-16 09:24:03 -05:00
source-path.hh Merge pull request #9985 from alois31/symlink-resolution 2024-02-16 09:24:03 -05:00
split.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
suggestions.cc Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
suggestions.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
sync.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
tarfile.cc Finish separating concerns with tarball cache 2024-02-15 10:34:01 -05:00
tarfile.hh Finish separating concerns with tarball cache 2024-02-15 10:34:01 -05:00
terminal.cc Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
terminal.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
thread-pool.cc Make some more threads receive interrupts 2024-01-03 19:30:02 +01:00
thread-pool.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
topo-sort.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
types.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
unix-domain-socket.cc bind: give same treatment as connect in #8544, dedup 2024-01-17 23:35:08 -05:00
unix-domain-socket.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
url-parts.hh Merge pull request #9621 from blaggacao/fix/too-restrictive-branch-regex-master 2023-12-22 16:02:25 +01:00
url.cc Merge remote-tracking branch 'origin/master' into profile-names-instead-of-index 2023-12-21 16:21:26 +01:00
url.hh isValidSchemeName: Add function 2023-12-11 12:12:43 +01:00
users.cc Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
users.hh Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
util.cc Drop parentheses from thunks 2024-01-16 17:00:46 +00:00
util.hh Improve String Handling 2024-01-16 17:00:46 +00:00
variant-wrapper.hh Fixing #7479 2023-08-18 11:44:00 -04:00
xml-writer.cc xml-writer: Remove std aliases 2022-02-25 16:13:02 +01:00
xml-writer.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00