1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00
Commit graph

18801 commits

Author SHA1 Message Date
Eelco Dolstra
5b32a021a9 Bump version 2025-01-13 16:55:24 +01:00
Jörg Thalheim
cadd9fbe88
Merge pull request #12243 from NixOS/mergify/bp/2.25-maintenance/pr-12235
libutil: thread-pool: ensure threads finished on error (backport #12235)
2025-01-13 09:42:12 +01:00
Dominique Martinet
0ccd1fa0a4 libutil: thread-pool: ensure threads finished on error
This fixes segfaults with nix copy when there was an error processing
addMultipleToStore.

Running with ASAN/TSAN pointed at an use-after-free with threads from
the pool accessing the graph declared in processGraph after the function
was exiting and destructing the variables.

It turns out that if there is an error before pool.process() is called,
for example while we are still enqueuing tasks, then pool.process()
isn't called and threads are still left to run.

By creating the pool last we ensure that it is stopped first before
running other destructors even if an exception happens early.

[ lix porting note: nix does not name threads so the patch has been
adapted to not pass thread name ]

Link: https://git.lix.systems/lix-project/lix/issues/618
Link: https://gerrit.lix.systems/c/lix/+/2355
(cherry picked from commit afac093b34)
2025-01-13 08:03:12 +00:00
mergify[bot]
8615df48a1
Merge pull request #12232 from NixOS/mergify/bp/2.25-maintenance/pr-12166
nix upgrade-nix: Give a better error message if the profile is using 'nix profile' (backport #12166)
2025-01-11 21:00:48 +00:00
Eelco Dolstra
6b03f1219e nix upgrade-nix: Give a better error message if the profile is using 'nix profile'
(cherry picked from commit fccfdbea57)
2025-01-11 20:07:00 +00:00
mergify[bot]
08cd0acf65
Merge pull request #12210 from NixOS/mergify/bp/2.25-maintenance/pr-11294
parser-state: fix attribute merging (backport #11294)
2025-01-10 20:39:33 +00:00
mergify[bot]
40e35dc567
Merge pull request #12189 from NixOS/mergify/bp/2.25-maintenance/pr-11853
fix(libmain/common-args): do not exceed maximum allowed verbosity (backport #11853)
2025-01-10 18:55:16 +00:00
mergify[bot]
1521a82077
Merge pull request #12184 from NixOS/mergify/bp/2.25-maintenance/pr-12051
Skip tests on systems with restricted usernamespaces (backport #12051)
2025-01-10 18:55:14 +00:00
mergify[bot]
009de1f7ac
Merge pull request #12179 from NixOS/mergify/bp/2.25-maintenance/pr-12103
fix: ignore symlinks in fsync-store-paths (backport #12103)
2025-01-10 18:55:11 +00:00
mergify[bot]
7a7a3d20d1
Merge pull request #12177 from NixOS/mergify/bp/2.25-maintenance/pr-12114
fix documentation of substring (backport #12114)
2025-01-10 18:55:08 +00:00
mergify[bot]
70ab8bbb28
Merge pull request #12175 from NixOS/mergify/bp/2.25-maintenance/pr-12115
libcmd: update to support lowdown-1.4 API (backport #12115)
2025-01-10 18:55:05 +00:00
Eelco Dolstra
c902a299a8
Merge pull request #12164 from NixOS/mergify/bp/2.25-maintenance/pr-12157
parsePathFlakeRefWithFragment(): Handle 'path?query' without a fragment (backport #12157)
2025-01-10 18:11:30 +01:00
Eelco Dolstra
dee91873bc
Merge pull request #12186 from NixOS/mergify/bp/2.25-maintenance/pr-12016
Disable suid and atime on the /nix mount point on Darwin (backport #12016)
2025-01-10 15:19:26 +01:00
Eelco Dolstra
31d6afb476
Merge pull request #12181 from NixOS/mergify/bp/2.25-maintenance/pr-12091
libstore: fixup unformatted uri when S3 getObject fails (backport #12091)
2025-01-10 15:17:50 +01:00
Eelco Dolstra
ef1e704707 Attempt to make the FlakeRef test succeed on macOS
(cherry picked from commit 3ad0f45e79)
2025-01-10 13:37:40 +01:00
Eelco Dolstra
21fe544ed9 Remove unused variable
(cherry picked from commit 1a38e62a09)
2025-01-10 13:37:36 +01:00
Eelco Dolstra
e1178b8a39 parsePathFlakeRefWithFragment(): Add unit tests
(cherry picked from commit 5f7b535b81)
2025-01-10 13:37:32 +01:00
Eelco Dolstra
31fa189123 parsePathFlakeRefWithFragment(): Handle query params in the non-git case
Backported from lazy-trees.

(cherry picked from commit 83ff523865)
2025-01-10 13:37:28 +01:00
Eelco Dolstra
faecb6e306 parsePathFlakeRefWithFragment(): Handle 'path?query' without a fragment
Commands like `nix flake metadata '.?submodules=1'` ignored the query
part of the URL, while `nix build '.?submodules=1#foo'` did work
correctly because of the presence of the fragment part.

(cherry picked from commit 28caa35a97)
2025-01-10 13:37:23 +01:00
Eelco Dolstra
200e3be41a ParsedURL: Remove base field
(cherry picked from commit 4077aa43a8)
2025-01-10 13:37:05 +01:00
Eelco Dolstra
8856b5f2ca ParsedURL: Remove url field
This prevents a 'url' field that is out of sync with the other
fields. You can use to_string() to get the full URL.

(cherry picked from commit f705ce7f9a)
2025-01-10 13:37:00 +01:00
Eelco Dolstra
aa5246bfe3 Drop std::make_pair
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
(cherry picked from commit ebb19cc1cd)
2025-01-10 13:36:43 +01:00
Eelco Dolstra
8b4a89f4bb Clean up flakeref parsing
This factors out some commonality in calling fromURL() and handling
the "dir" parameter into a fromParsedURL() helper function.

(cherry picked from commit 850281908c)
2025-01-10 13:36:37 +01:00
Eelco Dolstra
ab4159ff99
Merge pull request #12174 from NixOS/mergify/bp/2.25-maintenance/pr-12127
toJSON: re-throw serialization exception (backport #12127)
2025-01-10 13:32:53 +01:00
mergify[bot]
b9f89c846d
Merge pull request #12171 from NixOS/mergify/bp/2.25-maintenance/pr-12155
Document `--max-freed` for `nix-collect-garbage` (backport #12155)
2025-01-10 11:00:31 +00:00
Ryan Hendrickson
5575a2f1c3 parser-state: fix attribute merging
(cherry picked from commit 8034589d7e)
2025-01-10 10:40:07 +00:00
Sergei Zimmerman
2cb2fbbca7 fix(libmain/common-args): do not exceed maximum allowed verbosity
This patch gets rid of UB when verbosity exceeds the maximum logging value of `lvlVomit = 7` and
reaches invalid values (e.g. 8). This is actually triggered in functional tests.
There are too many occurrences to list, but here's one from the UBSAN log:

../src/libstore/gc.cc:610:5: runtime error: load of value 8, which is not a valid value for type 'Verbosity'

(cherry picked from commit b9f8c4af40)
2025-01-10 10:04:40 +00:00
Graham Christensen
6e9281be6d Disable suid and atime on the /nix mount point on Darwin
The Determinate Nix Installer has set nosuid and noatime in https://github.com/DeterminateSystems/nix-installer/pull/1338, and figured this perf and security improvement is worthy of upstreaming.

The /nix volume shouldn't have setuid binaries anyway, and filesystems seem to generally be noatime on macOS.
Further, the garbage collector doesn't use atime.

(cherry picked from commit 4137ead7a1)
2025-01-10 09:56:36 +00:00
Jörg Thalheim
4e990b0bcb functional-tests: skip tests if the kernel restricts unprivileged user namespaces
Update tests/functional/common/functions.sh

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
(cherry picked from commit da7f7ba810)
2025-01-10 09:52:32 +00:00
Cole Helbling
8f5ea8b8ca libstore: fixup unformatted uri when S3 getObject fails
(cherry picked from commit b978fa8450)
2025-01-10 09:48:23 +00:00
Cole Helbling
f8999cd4ee tests/nixos/s3-binary-cache-store: disable default substituter so it runs faster
Since networking is disabled in these VMs, trying to talk to the default
cache.nixos.org slows the test down (since it can't resolve it).

(cherry picked from commit f0c1262d23)
2025-01-10 09:48:23 +00:00
Cole Helbling
6aaf623058 tests/nixos/s3-binary-cache-store: test that "object does not exist" error message is properly formatted
(cherry picked from commit 535724fd79)
2025-01-10 09:48:22 +00:00
Yaroslav Bolyukin
24a9c6fad9 fix: ignore symlinks in fsync-store-paths
Fixes: https://github.com/NixOS/nix/issues/12099
(cherry picked from commit 4a91e627a7)
2025-01-10 09:45:22 +00:00
Philipp Otterbein
d54c283821 fix documentation of substring
(cherry picked from commit 1e2cace5f1)
2025-01-10 09:44:18 +00:00
Sergei Trofimovich
bead70acc2 libcmd: update to support lowdown-1.4 API
Upstream change
bab1d75079
moved a few fields from `lowdown_opts` toa  new `lowdown_opts_term`
struct. As a result the build started failing as:

    nix-cmd> [2/17] Compiling C++ object libnixcmd.so.p/markdown.cc.o
    nix-cmd> FAILED: libnixcmd.so.p/markdown.cc.o
    nix-cmd> g++ -Ilibnixcmd.so.p -I. -I.. -I/nix/store/b0bnrk5lacxbpgxgnc28r8q3wcazrgxj-nix-util-2.26.0pre-dev/include/nix -I/nix/store/cxnynq9ykyj4xxv6wf6dw7r0aw5x6n9k-libarchive-3.7.7-dev/include -I/nix/store/bfgjwkcb8snkizx578rzdahi75m8zyh4-nlohmann_json-3.11.3/include -I/nix/store/3sx8bq3sip6j2nv1m5xx4gbdp33v7iy6-nix-store-2.26.0pre-dev/include/nix -I/nix/store/sih2dgqzvsbv7p510lkfmas7s7wbsl4j-nix-fetchers-2.26.0pre-dev/include/nix -I/nix/store/68p8s20fsiiakj7nys7grbaixfnhsdzs-nix-expr-2.26.0pre-dev/include/nix -I/nix/store/gw7wknhzhfzzj9zww2kyi5xrzgf1ndki-boehm-gc-8.2.8-dev/include -I/nix/store/3jwb9j4vnsk5saq3wfyyp9il3mhs41l9-nix-flake-2.26.0pre-dev/include/nix -I/nix/store/8nwjvmq7m48v8g646jrxkikv6x47bc3m-nix-main-2.26.0pre-dev/include/nix -I/nix/store/rb0hzsw5wc1a7daizhpj824mbxlvijrq-lowdown-1.4.0-dev/include -I/nix/store/m388ywpk53fsp8r98brfd7nf1f5sskv0-editline-1.17.1-dev/include -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++2a -include config-util.hh -include config-store.hh -include config-expr.hh -include config-main.hh -include config-cmd.hh -Wdeprecated-copy -Werror=suggest-override -Werror=switch -Werror=switch-enum -Werror=unused-result -Wignored-qualifiers -Wimplicit-fallthrough -Wno-deprecated-declarations -O3 -fPIC -pthread -std=c++2a -std=c++2a -std=c++2a -std=c++2a -std=c++2a -std=c++2a -MD -MQ libnixcmd.so.p/markdown.cc.o -MF libnixcmd.so.p/markdown.cc.o.d -o libnixcmd.so.p/markdown.cc.o -c ../markdown.cc
    nix-cmd> ../markdown.cc: In function 'std::string nix::doRenderMarkdownToTerminal(std::string_view)':
    nix-cmd> ../markdown.cc:28:5: error: 'lowdown_opts' has no non-static data member named 'cols'
    nix-cmd>    28 |     };
    nix-cmd>       |     ^

The change adds version-based conditional to support both pre-1.4 and
1.4 forms of the initialization.

Closes: https://github.com/NixOS/nix/issues/12113
(cherry picked from commit edbfe863ce)
2025-01-10 09:43:18 +00:00
Philipp Otterbein
4bf020de50 toJSON: re-throw serialization exception
(cherry picked from commit 4a2310a3a0)
2025-01-10 09:42:14 +00:00
Domagoj Mišković
6b5b538d98 Document --max-freed for nix-collect-garbage (#12155)
* Update nix-collect-garbage.md

Referencing issue at: https://github.com/NixOS/nix/issues/12132

Copied the description of `--max-freed` option from 442a2623e4/doc/manual/source/command-ref/nix-store/gc.md (L39-L44)

(cherry picked from commit 5230d3ecc4)
2025-01-10 09:37:10 +00:00
mergify[bot]
85a4f62400
Merge pull request #12151 from NixOS/mergify/bp/2.25-maintenance/pr-12143
mergify: fix installer test name (backport #12143)
2025-01-07 19:42:57 +00:00
Jörg Thalheim
f9fc7fea5c mergify: fix installer test name
(cherry picked from commit 438a20427f)
2025-01-07 19:18:11 +00:00
Jörg Thalheim
e67cf5f306
Merge pull request #12145 from NixOS/mergify/bp/2.25-maintenance/pr-12046
CLI symlink fixes (backport #12046)
2025-01-07 07:54:59 +01:00
Robert Hensing
336fdaa119 test: Avoid regressing accidental use of weakly_canonical instead of makeParentCanonical
I'd messed up a rebase in my previous iteration, causing `weakly_canonical` to reappear,
but not trigger a test failure.

These two functions behave similarly when the argument is a path that points to a broken
symlink. `weakly_canonical` would not resolve it because the target doesn't exist, and
`makeParentCanonical` would not resolve it, because it never resolves the final path
element.
This new test case now also tests a valid symlink, "differentiating" the two.

(cherry picked from commit 4c74d679b6)
2025-01-07 06:03:58 +00:00
Jörg Thalheim
b0784dd69b makeParentCanonical: test case where parent is empty
(cherry picked from commit 5a5a86949a)
2025-01-07 06:03:58 +00:00
Robert Hensing
7c4e2fdfd7 test: Add hydraJobs.tests.functional_symlinked-home
(cherry picked from commit 628c11d237)
2025-01-07 06:03:57 +00:00
Robert Hensing
3fbcd8d7ba fix: Resolve CLI parent symlinks before adding to store
Fixes https://github.com/NixOS/nix/issues/11941

(cherry picked from commit ddbbf53767)
2025-01-07 06:03:57 +00:00
Robert Hensing
fdd61cf529 refactor: Don't re-construct SourcePath unnecessarily
(cherry picked from commit c0b64f3377)
2025-01-07 06:03:57 +00:00
Robert Hensing
6d7ef8f29d doc: Document nix-store --add-fixed symlink behavior
Tested with

    nix run nix/2.3-maintenance#nix-store -- --add some_symlink
    nix run nix/2.3-maintenance#nix-store -- --add-fixed sha256 --recursive some_symlink

(cherry picked from commit 91e91f62fa)
2025-01-07 06:03:56 +00:00
Robert Hensing
255379daf1 fix: Handle symlinks and FIFOs in nix hash where possible
Fixes https://github.com/NixOS/nix/issues/11756
Fixes https://github.com/NixOS/nix/issues/11681

(cherry picked from commit 36563c69a4)
2025-01-07 06:03:56 +00:00
Robert Hensing
0213f22650 Add makeParentCanonical()
(cherry picked from commit 69853c067c)
2025-01-07 06:03:55 +00:00
Jörg Thalheim
8abff3cf05
Merge pull request #12075 from NixOS/mergify/bp/2.25-maintenance/pr-12059
installer: make sure we can always test the installer in ci and locally (backport #12059)
2025-01-07 00:32:01 +01:00
Robert Hensing
d910cab254 .github/ci: Use fixed names
This lets us update "runs-on" without creating a mismatch with the
required checks that are configured for the repo in the github ui.
2025-01-07 00:05:23 +01:00