1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-09 02:21:02 +01:00
Commit graph

12435 commits

Author SHA1 Message Date
Eelco Dolstra
731b630321 Fixes for GHSA-g948-229j-48j3
Squashed commit of the following:

commit 04fff3a637d455cbb1d75937a235950e43008db9
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 12:30:32 2025 +0200

    Chown structured attr files safely

commit 5417ad445e414c649d0cfc71a05661c7bf8f3ef5
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 12:14:04 2025 +0200

    Replace 'bool sync' with an enum for clarity

    And drop writeFileAndSync().

commit 7ae0141f328d8e8e1094be24665789c05f974ba6
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 11:35:28 2025 +0200

    Drop guessOrInventPathFromFD()

    No need to do hacky stuff like that when we already know the original path.

commit 45b05098bd019da7c57cd4227a89bfd0fa65bb08
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 11:15:58 2025 +0200

    Tweak comment

commit 0af15b31209d1b7ec8addfae9a1a6b60d8f35848
Author: Raito Bezarius <raito@lix.systems>
Date:   Thu Mar 27 12:22:26 2025 +0100

    libstore: ensure that temporary directory is always 0o000 before deletion

    In the case the deletion fails, we should ensure that the temporary
    directory cannot be used for nefarious purposes.

    Change-Id: I498a2dd0999a74195d13642f44a5de1e69d46120
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 2c20fa37b15cfa03ac6a1a6a47cdb2ed66c0827e
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 12:42:55 2025 +0100

    libutil: ensure that `_deletePath` does NOT use absolute paths with dirfds

    When calling `_deletePath` with a parent file descriptor, `openat` is
    made effective by using relative paths to the directory file descriptor.

    To avoid the problem, the signature is changed to resist misuse with an
    assert in the prologue of the function.

    Change-Id: I6b3fc766bad2afe54dc27d47d1df3873e188de96
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit d3c370bbcae48bb825ce19fd0f73bb4eefd2c9ea
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:07:47 2025 +0100

    libstore: ensure that `passAsFile` is created in the original temp dir

    This ensures that `passAsFile` data is created inside the expected
    temporary build directory by `openat()` from the parent directory file
    descriptor.

    This avoids a TOCTOU which is part of the attack chain of CVE-????.

    Change-Id: Ie5273446c4a19403088d0389ae8e3f473af8879a
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 45d3598724f932d024ef6bc2ffb00c1bb90e6018
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:06:03 2025 +0100

    libutil: writeFile variant for file descriptors

    `writeFile` lose its `sync` boolean flag to make things simpler.

    A new `writeFileAndSync` function is created and all call sites are
    converted to it.

    Change-Id: Ib871a5283a9c047db1e4fe48a241506e4aab9192
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 732bd9b98cabf4aaf95a01fd318923de303f9996
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:05:34 2025 +0100

    libstore: chown to builder variant for file descriptors

    We use it immediately for the build temporary directory.

    Change-Id: I180193c63a2b98721f5fb8e542c4e39c099bb947
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 962c65f8dcd5570dd92c72370a862c7b38942e0d
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:04:59 2025 +0100

    libstore: open build directory as a dirfd as well

    We now keep around a proper AutoCloseFD around the temporary directory
    which we plan to use for openat operations and avoiding the build
    directory being swapped out while we are doing something else.

    Change-Id: I18d387b0f123ebf2d20c6405cd47ebadc5505f2a
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit c9b42462b75b5a37ee6564c2b53cff186c8323da
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:04:12 2025 +0100

    libutil: guess or invent a path from file descriptors

    This is useful for certain error recovery paths (no pun intended) that
    does not thread through the original path name.

    Change-Id: I2d800740cb4f9912e64c923120d3f977c58ccb7e
    Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-06-24 09:27:39 -04:00
Eelco Dolstra
7059d2b58b Merge remote-tracking branch 'origin/2.29-maintenance' into sync-2.29.1 2025-06-23 15:02:22 +02:00
Eelco Dolstra
1d5e161755
Merge pull request #113 from DeterminateSystems/eelcodolstra/fh-851-lock-nar-hashes-by-default
Add lazy-locks setting
2025-06-19 17:01:14 +00:00
Eelco Dolstra
3a4e6cadeb Improve regression testing for uncachable source paths
These now throw an error by default in the test suite.
2025-06-16 23:59:33 +02:00
Eelco Dolstra
a175c67def Fix rootFS fingerprint in the impure case 2025-06-16 23:59:33 +02:00
Eelco Dolstra
5329a45ade Git fetcher: Make dirty repos with no commits cacheable 2025-06-16 23:59:33 +02:00
Eelco Dolstra
b2905dc08e fetchToStore(): Address a FIXME 2025-06-16 12:27:44 -04:00
Eelco Dolstra
e3fa4faff9 fetchToStore(): Don't require a valid path in dry run mode 2025-06-16 12:27:44 -04:00
Eelco Dolstra
af5815fd54 Give unit tests access to a $HOME directory
Also, don't try to access cache.nixos.org in the libstore unit tests.
2025-06-16 12:27:44 -04:00
Eelco Dolstra
dc5e620032 fetchToStore() cache: Use content hashes instead of store paths
We can always compute the store path from the content hash, but not
vice versa. Storing the content hash allows `hashPath()` to be
replaced by `fetchToStore(...FetchMode::DryRun...)`, which gets us
caching in lazy-trees mode.
2025-06-16 12:27:44 -04:00
Eelco Dolstra
8b9cb382e9 Fix path field in fetcher cache
86785fd9d1 was broken because it was
storing the full path in the MountedSourceAccessor as the `path` field
in the fetcher cache key (i.e. including the
/nix/store/... prefix). Especially in the case of lazy (virtual) store
paths, this didn't work at all because those paths are different every time.
2025-06-13 22:29:20 +02:00
Eelco Dolstra
cbedb8e19a Fix broken fetchToStore() caching on unlocked inputs 2025-06-13 22:29:20 +02:00
Eelco Dolstra
b2c762cd2f
Apply suggestions from code review
Co-authored-by: Luc Perkins <lucperkins@gmail.com>
2025-06-13 21:03:58 +02:00
Eelco Dolstra
802f585406 Add lazy-locks setting
This determines whether lock file entries omit a NAR hash. They're
included by default to make lazy trees compatible with older clients.
2025-06-13 17:45:37 +02:00
Luc Perkins
b8e8214d5f
Fix one more 'will' 2025-06-12 08:28:01 -07:00
Luc Perkins
e565571f69
Re-supply inadvertently deleted word 2025-06-12 08:25:10 -07:00
Eelco Dolstra
279a6b18db Formatting 2025-06-12 16:13:28 +02:00
Eelco Dolstra
6477d7c2ca mountInput(): Optimize getting the NAR hash for real store paths 2025-06-12 16:11:54 +02:00
Eelco Dolstra
fca291afc3 Fix NAR hash checking for fetchGit with lazy tees
If a NAR hash is specified, we should probably check
it. Unfortunately, for now this has the side effect of forcing NAR
hash checking of any input that has a NAR hash.
2025-06-12 16:02:42 +02:00
Eelco Dolstra
b067e6566f Git fetcher: Do not consider a null revision (i.e. workdir) to be locked 2025-06-12 16:02:42 +02:00
Cole Helbling
3114862518
Merge pull request #98 from DeterminateSystems/fix-fetchToStore-dryRun-caching
fetchToStore(): Improve caching in dry-run mode
2025-06-12 00:25:23 +00:00
Eelco Dolstra
168184a0d4
Merge pull request #100 from DeterminateSystems/lib-tests-lazy
Run nixpkgsLibTests in lazy trees mode
2025-06-11 18:51:13 +00:00
Luc Perkins
27755169f9
Merge pull request #92 from DeterminateSystems/lucperkins/fh-864-fix-error-messages-to-avoid-fake-future-tense
Fix some instances of 'will'
2025-06-11 17:27:24 +00:00
Luc Perkins
42c50aafad
Fix broken link in configuration description 2025-06-11 08:55:46 -07:00
Eelco Dolstra
31e58dcb92 nix-instantiate --eval --xml: Devirtualize the output 2025-06-11 17:18:42 +02:00
Eelco Dolstra
df7a2a1bed nix-instantiate --eval --json: Devirtualize the output 2025-06-11 17:14:33 +02:00
Eelco Dolstra
2f5a545997 fetchToStore(): Improve caching in dry-run mode
In dry-run mode, we don't need to require a valid path.
2025-06-11 16:13:40 +02:00
Graham Christensen
c6f87378db
Update src/libmain/plugin.cc
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-06-11 10:02:27 -04:00
Graham Christensen
ac6318c9c5
Merge pull request #97 from DeterminateSystems/fix-duplicate-builtins
Don't register extra primops twice
2025-06-11 13:10:23 +00:00
Eelco Dolstra
7f6efe93e4 Don't register extra primops twice
This was the result of a bad merge.
2025-06-11 13:06:14 +02:00
Eelco Dolstra
86785fd9d1 fetchToStore(): Fix caching
This was broken because MountedSourceAccessor did not return a
fingerprint. Previously fingerprints were global to an accessor, but
with a MountedSourceAccessor the fingerprint can be different for each
mount point.
2025-06-06 22:09:35 +02:00
Eelco Dolstra
f8ef941c04 fetchToStore(): Cache in dry-run mode 2025-06-06 21:50:55 +02:00
Eelco Dolstra
74af43ee91
Remove superfluous semicolon
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2025-06-06 20:03:33 +02:00
Luc Perkins
a989a23d1a
Fix some instances of 'will' 2025-06-06 10:51:58 -07:00
Eelco Dolstra
e18b1637dc Fix display of paths in substituted source trees
These got displayed as e.g.

  «github:NixOS/nixpkgs/adaa24fbf46737f3f1b5497bf64bae750f82942e?narHash=sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY%3D»/nix/store/x9wnkly3k1gkq580m90jjn32q9f05q2v-source/pkgs/stdenv/generic/source-stdenv.sh

Now we get

  «github:NixOS/nixpkgs/adaa24fbf46737f3f1b5497bf64bae750f82942e?narHash=sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY%3D»/pkgs/stdenv/generic/source-stdenv.sh
2025-06-06 19:41:12 +02:00
Eelco Dolstra
a69b99ade0 Add ForwardingSourceAccessor 2025-06-06 19:40:57 +02:00
Seth Flynn
fcdffffa37 lockFlake(): Allow registry lookups for overridden inputs
Fixes #13144

(cherry picked from commit d0a2323829)
2025-06-06 08:12:20 +00:00
Cole Helbling
dfa7b2a288
libstore/unix/derivation-builder: error earlier when sandbox path is inaccessible 2025-06-04 12:16:34 -07:00
Cole Helbling
63e9e9df37
fixup: only show "you can rerun" message if the derivation's platform is supported on this machine 2025-06-03 10:53:05 -07:00
Sergei Zimmerman
a2567f6d7a Clear displayPrefix in makeEmptySourceAccessor
Judging by the comment for `makeEmptySourceAccessor` the prefix has
to be empty:

> Return a source accessor that contains only an empty root directory.

Fixes #13295.

(cherry picked from commit fba1bb0c13)
2025-06-03 19:27:15 +02:00
Cole Helbling
242719cffb
--keep-failed with remote builders will keep the failed build directory on that builder 2025-06-02 14:41:29 -07:00
Graham Christensen
f8aabb0749
Merge pull request #79 from DeterminateSystems/path-position-info
Include the source location when warning about inefficient double copies
2025-06-02 18:51:49 +00:00
Graham Christensen
7a450a8ba9
Update src/libexpr/paths.cc 2025-06-02 14:08:42 -04:00
Graham Christensen
8a82624801
Merge pull request #81 from DeterminateSystems/push-twpuyuspwtpz
Replace ε and ∅
2025-06-02 17:32:11 +00:00
Graham Christensen
1500e541f2 diff-closures: use removed / added words 2025-06-02 11:21:26 -04:00
Eelco Dolstra
665e76f2e5 deletePath(): Keep going when encountering an undeletable file
This should reduce the impact of #5207.
2025-06-02 17:17:09 +02:00
Graham Christensen
724d552b64 Use words like added / removed 2025-06-02 09:30:18 -04:00
Graham Christensen
039d19159f Replace ∅ with (absent) 2025-06-02 09:29:55 -04:00
Graham Christensen
7d2dbbd3aa Rename ε to "(no version)" 2025-06-02 09:22:55 -04:00
Eelco Dolstra
b16fa06ff1 nix store copy-sigs: Add docs 2025-06-02 12:06:21 +02:00