1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-10-18 14:32:45 -04:00
Commit graph

18511 commits

Author SHA1 Message Date
Philipp Otterbein 5cf6b2cb75 eval: remove superfluous strdup 2024-09-30 22:15:04 +02:00
Philipp Otterbein c7db10000c fix: include missing header when GC is disabled 2024-09-30 21:27:06 +02:00
tomberek 14f029dbe8
Merge pull request #11489 from bryanhonof/bryanhonof.warn-on-malformed-uri-query
fix: warn on malformed URI query parameter
2024-09-30 12:14:40 -04:00
Yann Hamdaoui f8268cbe16
Fix NAR tests on Linux+ZFS+normalize
A test added recently checks that when trying to deserialize a NAR with
two files that Unicode-normalize to the same result either succeeds on
Linux, or fails with an "already exists" error on Darwin. However,
failing with an "already exists" error can in fact also happen on Linux,
when using ZFS with the proper utf8 and Unicode normalization options
set.

This commit fixes the issue by not assuming the behavior from the
current system, but just by blindly checking that either one of the two
aforementioned possibilities happen, whether on Darwin or on Linux.

Additionally, we check that the Unicode normalization behaviour of
nix-store is the same as the host file system.
2024-09-30 16:29:51 +02:00
Bryan Honof 5150a962f5
test(functional/flakes): add dubious-query
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2024-09-30 14:44:06 +02:00
Bryan Honof 1f024ecfcd
fix: warn on malformed URI query parameter 2024-09-30 14:44:06 +02:00
Robert Hensing c116030605
Merge pull request #11602 from Mic92/macos-test-fix
tests/functional/flakes/run: fix tests in macOS devshell
2024-09-30 13:37:54 +02:00
Robert Hensing 4e31360637
Reference issue in tests/functional/flakes/run.sh 2024-09-30 13:02:51 +02:00
Robert Hensing 3df619339c Split ignoreException for destructors or interrupt-safe 2024-09-30 11:50:25 +02:00
Valentin Gagarin a1415471b8
Merge pull request #11611 from jljusten/spelling-fixes 2024-09-30 01:20:40 +02:00
tomberek 973d4ede84
Merge pull request #11614 from Gerg-L/master
nix-ng: add meta.mainProgram
2024-09-29 18:28:56 -04:00
Gerg-L a614fbb2a2
nix-ng: add meta.mainProgram 2024-09-29 15:04:41 -04:00
Valentin Gagarin 79138183a9
Merge pull request #11613 from NixOS/nix-fmt-doc
doc/nix fmt: Do not document behavior we do not control
2024-09-29 20:48:43 +02:00
Robert Hensing 8c4842de8c doc/nix fmt: Do not document behavior we do not control
This leads to confusion about what the command does.
E.g. https://github.com/NixOS/nix/issues/9359

- Move the description up

- Remove details about the individual formatters
2024-09-29 19:53:36 +02:00
Jordan Justen 3b6cf350e7
doc, src: Fix various spelling typos
Signed-off-by: Jordan Justen <jljusten@gmail.com>
2024-09-28 15:29:15 -07:00
Jörg Thalheim 410853ddcf tests/nixos/fetchurl: drop unused variables 2024-09-28 17:08:18 +02:00
Puck Meerburg c1ecf0bee9 fix passing CA files into builtins:fetchurl sandbox
This patch has been manually adapted from
14dc84ed03

Tested with:

$ NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
Finished at 16:57:50 after 1s
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com> building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com> error:
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com>        … writing file '/nix/store/0zynn4n8yx59bczy1mgh1lq2rnprvvrc-google.com'
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com>
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com>        error: unable to download 'https://google.com': Problem with the SSL CA cert (path? access rights?) (77) error setting certificate file: /nix/store/nlgbippbbgn38hynjkp1ghiybcq1dqhx-nss-cacert-3.101.1/etc/ssl/certs/ca-bundle.crt
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
error: builder for '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv' failed with exit code 1

Now returns:

nix-env % NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
Finished at 17:05:48 after 0s
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com> building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
error: hash mismatch in fixed-output derivation '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
2024-09-28 17:08:16 +02:00
Eelco Dolstra 08deebddf2
Merge pull request #11600 from DeterminateSystems/fix-uncaught-exception
HttpBinaryCacheStore::getFile(): Fix uncaught exception
2024-09-27 12:37:12 +02:00
Eelco Dolstra f8bd7e7e5c
Merge pull request #11598 from joshheinrichs-shopify/fix-http-cache-reference
Fix reference to HTTP Binary Cache Store in docs
2024-09-27 11:43:41 +02:00
Jörg Thalheim 3b0c5ab835 tests/functional/flakes/run: fix tests in macOS devshell
same fix as in 04a47e93f6
2024-09-27 11:07:50 +02:00
Valentin Gagarin aee34e4776
fix location 2024-09-27 11:07:04 +02:00
Eelco Dolstra 4566854981 HttpBinaryCacheStore::getFile(): Fix uncaught exception
This method is marked as `noexcept`, but `enqueueFileTransfer()` can
throw `Interrupted` if the user has hit Ctrl-C or if the `ThreadPool`
that the thread is a part of is shutting down.
2024-09-27 00:16:52 +02:00
Eelco Dolstra 0ed67e5b7e
Merge pull request #11581 from Mic92/git-cache
create git caches atomically
2024-09-26 21:58:22 +02:00
Josh Heinrichs 1271a95b79
Fix reference to HTTP Binary Cache Store in docs 2024-09-26 12:30:41 -06:00
Jörg Thalheim 12d5b2cfa1 create git caches atomically
When working on speeding up the CI,
I triggered a race condition in the creation of the tarball cache.
This code now instead will ensure that half-initialized repositories
are no longer visible to any other nix process.

This is the error message that I got before:

error: opening Git repository '"/Users/runner/.cache/nix/tarball-cache"': could not find repository at '/Users/runner/.cache/nix/tarball-cache'
2024-09-26 17:46:25 +02:00
Jason Yundt a5959aa121
docs: specify that flake.lock files are JSON (#11594)
* docs: specify that flake.lock files are JSON

Recently, I decided that I was going to write some code that would parse
flake.lock files. I went to the Nix Reference Manual in order to look up
information on the format of flake.lock files, and I realized that a key
detail was missing from the Nix Reference Manual: it never says that
flake.lock files are JSON files. This commit fixes that issue.

This commit makes sure to specify that flake.lock files are encoded in
UTF-8. Confusingly, there’s multiple different JSON standards. Neither
ECMA-404, 2nd Edition [1] nor ISO/IEC 21778:2017 [2] mention UTF-8. RFC
8259 requires UTF-8, but only sometimes [3]. I chose to explicitly
specify that flake.lock files are UTF-8 in order to avoid any possible
ambiguities from the JSON standards.

[1]: <https://ecma-international.org/publications-and-standards/standards/ecma-404>
[2]: <https://www.iso.org/standard/71616.html>
[3]: <https://www.rfc-editor.org/rfc/rfc8259.html#section-8.1>
2024-09-26 00:21:33 +00:00
Eelco Dolstra 4dc4e81b1e
Merge pull request #11593 from DeterminateSystems/typo
Fix typo
2024-09-26 00:55:46 +02:00
Eelco Dolstra ef8987955b Typo 2024-09-26 00:15:04 +02:00
Eelco Dolstra 062b4a489e
Merge pull request #11585 from NixOS/verify-tls
builtin:fetchurl: Enable TLS verification
2024-09-25 23:52:25 +02:00
Eelco Dolstra 7b39cd631e Add release note 2024-09-25 23:07:11 +02:00
Valentin Gagarin 6c37d81514
Merge pull request #11584 from Mic92/devdocs 2024-09-25 13:44:49 +02:00
Jörg Thalheim eb3a368a33 docs/testing: add --verbose flag for running single tests
Most of the time people run single tests for debugging reason,
so it's a sane default to have them see all the console output.

This commit still retains the section about running tests directly with
meson, because in some debugging cases it's just nice to have less
abstractions i.e. when using strace.
2024-09-25 09:46:29 +02:00
Eelco Dolstra f2f47fa725 Add a test for builtin:fetchurl cert verification 2024-09-24 16:13:28 +02:00
John Ericson 322d2c767f
Merge pull request #11523 from obsidiansystems/base64Decode-no-leak-private-key-on-error
Ensure error messages don't leak private key
2024-09-23 17:13:32 -04:00
John Ericson 2b6b03d8df Ensure error messages don't leak private key
Since #8766, invalid base64 is rendered in errors, but we don't actually
want to show this in the case of an invalid private keys.

Co-Authored-By: Eelco Dolstra <edolstra@gmail.com>
2024-09-23 16:36:48 -04:00
Eelco Dolstra c04bc17a5a builtin:fetchurl: Enable TLS verification
This is better for privacy and to avoid leaking netrc credentials in a
MITM attack, but also the assumption that we check the hash no longer
holds in some cases (in particular for impure derivations).

Partially reverts 5db358d4d7.
2024-09-23 15:15:43 +02:00
Ryan Hendrickson da332d678e libexpr: deprecate the bogus "or"-as-variable
As a prelude to making "or" work like a normal variable, emit a warning
any time the "fn or" production is used in a context that will change
how it is parsed when that production is refactored.

In detail: in the future, OR_KW will be moved to expr_simple, and the
cursed ExprCall production that is currently part of the expr_select
nonterminal will be generated "normally" in expr_app instead. Any
productions that accept an expr_select will be affected, except for the
expr_app nonterminal itself (because, while expr_app has a production
accepting a bare expr_select, its other production will continue to
accept "fn or" expressions). So all we need to do is emit an appropriate
warning when an expr_simple representing a cursed ExprCall is accepted
in one of those productions without first going through expr_app.

As the warning message describes, users can suppress the warning by
wrapping their problematic "fn or" expressions in parentheses. For
example, "f g or" can be made future-proof by rewriting it as
"f (g or)"; similarly "[ x y or ]" can be rewritten as "[ x (y or) ]",
etc. The parentheses preserve the current grouping behavior, as in the
future "f g or" will be parsed as "(f g) or", just like
"f g anything-else" is grouped. (Mechanically, this suppresses the
warning because the problem ExprCalls go through the
"expr_app : expr_select" production, which resets the cursed status on
the ExprCall.)
2024-09-20 15:57:36 -04:00
John Ericson d0c351bf43 Revert "base64Decode: clearer error message when an invalid character is detected"
We have a safer way of doing this.

This reverts commit dc3ccf02bf.
2024-09-20 10:41:45 -04:00
Eelco Dolstra 68ba6ff470
Merge pull request #11558 from DeterminateSystems/fix-no-gc-build
Fix build without GC
2024-09-20 16:02:08 +02:00
Eelco Dolstra ec47133be3 Fix warning 2024-09-20 15:08:45 +02:00
Eelco Dolstra 088569463b Fix build without GC 2024-09-20 15:01:32 +02:00
Eelco Dolstra c5c68558b5
Merge pull request #11550 from DeterminateSystems/traceable-allocator-alias
Alias traceable_allocator to std::allocator when building without GC
2024-09-20 10:43:31 +02:00
Eelco Dolstra b2bb92ef09 Formatting
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2024-09-19 22:59:42 +02:00
Eelco Dolstra 2f4a7a8301 Add a few more aliases 2024-09-19 21:04:01 +02:00
Eelco Dolstra 589d8f1f2b Move GC-related definitions to eval-gc.hh 2024-09-19 21:04:01 +02:00
Eelco Dolstra 31d408c351 Alias gc_allocator 2024-09-19 21:04:01 +02:00
Eelco Dolstra b9f78abb7f Alias traceable_allocator to std::allocator when building without GC
This allows us to get rid of a bunch of #ifdefs.
2024-09-19 21:04:01 +02:00
Eelco Dolstra ca3fc1693b
Merge pull request #11548 from DeterminateSystems/fix-zipAttrsWith-gc
Fix missing GC root in zipAttrsWith
2024-09-19 21:02:36 +02:00
Eelco Dolstra 4449b0da74
Use HAVE_BOEHMGC
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-09-19 19:52:47 +02:00
Eelco Dolstra 0c2fdd2f3c Fix missing GC root in zipAttrsWith
My SNAFU was that I assumed that all the `Value *`s we put in
`attrsSeen` are already reachable (which they are), but I forgot about
the `elems` pointer in `ListBuilder`.

Fixes #11547.
2024-09-19 19:16:31 +02:00