1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00
Commit graph

2638 commits

Author SHA1 Message Date
Robert Hensing bbef37b4a6
Merge pull request #11423 from DeterminateSystems/ignore-stale-submodules
Git fetcher: Ignore .gitmodules entries that are not submodules
2024-09-12 18:14:18 +02:00
Eelco Dolstra 5737d31d4e Test the case hack a bit more 2024-09-12 17:27:41 +02:00
Eelco Dolstra 7aa3e7e3a5 Make the NAR parser much stricter wrt field order
We really want to enforce a canonical representation since NAR
hashing/signing/deduplication depends on that.
2024-09-12 15:57:46 +02:00
Eelco Dolstra 421aa1add1 Add tests for invalid file names in NARs
Note: in general, we rely on the OS to tell us if a name is invalid or
if two names normalize in the same way. But for security, we do want
to make sure that we catch '.', '..', slashes and NUL characters. (NUL
characters aren't really a security issue, but since they would be
truncated when we pass them to the OS, it would be canonicity problem.)
2024-09-12 15:02:30 +02:00
Eelco Dolstra 894da59186
Merge pull request #11447 from DeterminateSystems/nix-flake-metadata-chroot-store
nix flake {metadata,archive}: Fix chroot stores
2024-09-11 14:51:56 +02:00
tomberek c60e1be62c
Merge pull request #11438 from zimbatm/nix-fmt-pwd
fix(nix fmt): remove the default "." argument
2024-09-10 23:44:16 -04:00
zimbatm c4766d7b8b fix(nix fmt): remove the default "." argument
When `nix fmt` is called without an argument, Nix appends the "." argument before calling the formatter. The comment in the code is:
> Format the current flake out of the box

This also happens when formatting sub-folders.

This means that the formatter is now unable to distinguish, as an interface, whether the "." argument is coming from the flake or the user's intent to format the current folder. This decision should be up to the formatter.

Treefmt, for example, will automatically look up the project's root and format all the files. This is the desired behaviour. But because the "." argument is passed, it cannot function as expected.
2024-09-10 22:18:56 +02:00
Eelco Dolstra 9c0e968843
Merge commit from fork
Fix unsafe NAR unpacking
2024-09-10 12:42:55 +02:00
Tom Bereknyei c55b285cf9 tests: test was re-named 2024-09-09 22:15:45 -04:00
Eelco Dolstra c5a4dfa660 nix flake {metadata,archive}: Fix chroot stores
Fixes

  $ nix flake metadata --store /tmp/nix nixpkgs
  error: path '/tmp/nix/nix/store/65xpqkz92d9j7k5ric4z8lzhiigxsfbg-source/flake.nix' is not in the Nix store

This has been broken since 598deb2b23.
2024-09-09 15:41:38 +02:00
Eelco Dolstra 4cfa59fdb3 Typo 2024-09-09 14:11:35 +02:00
Eelco Dolstra 52ba3cc5ea Test that deserializing regular files / symlinks is exclusive 2024-09-06 16:28:09 +02:00
Eelco Dolstra 9fcb588dd8 RestoreSink::createDirectory(): Use append()
On macOS, `mkdir("x/')` behaves differently than `mkdir("x")` if `x` is
a dangling symlink (the formed succeed while the latter fails). So make
sure we always strip the trailing slash.
2024-09-05 22:21:53 +02:00
Eelco Dolstra 21dcbd7e83 Fix test on macOS 2024-09-05 20:55:24 +02:00
Eelco Dolstra 7a765a6aaf Test that deserializing NARs with names with equal Unicode normal forms fails on macOS
The test is based on the one by @puckipedia but with the file names
swapped to make them sorted.
2024-09-05 20:37:26 +02:00
Eelco Dolstra 3557587381 Detect NAR directory entries that collide with another path after case-hacking
The test was made by @puckipedia.
2024-09-05 19:26:10 +02:00
Eelco Dolstra 77c090cdbd More tests 2024-09-05 16:54:12 +02:00
Eelco Dolstra da1ad28912 Test that nix-store --restore fails if the output already exists
This restores the behaviour from before the std::filesystem
refactorings.
2024-09-05 16:48:43 +02:00
Eelco Dolstra 83d5b32803 Add test case for NARs with duplicate directory entries
This test was made by @puckipedia.
2024-09-05 16:41:15 +02:00
Eelco Dolstra 9d24080090 Git fetcher: Ignore .gitmodules entries that are not submodules
Fixes #10739.
2024-09-04 14:46:33 +02:00
Parker Hoyes 4c88deef38 Add tests for daemon with cgroups 2024-09-03 17:27:56 +00:00
John Ericson c7ec33605e Meson misc things
Meson-ify a few things, scripts, completions, etc. Should make our Meson
build complete except for docs.

Co-Authored-By: Qyriad <qyriad@qyriad.me>
Co-Authored-By: eldritch horrors <pennae@lix.systems>
2024-08-27 10:19:55 -04:00
John Ericson a97a08411c More support for std::filepath in libnixutil
We're not replacing `Path` in exposed definitions in many cases, but
just adding alternatives. This will allow us to "top down" change `Path`
to `std::fileysystem::path`, and then we can remove the `Path`-using
utilities which will become unused.

Also add some test files which we forgot to include in the libutil unit
tests `meson.build`.

Co-Authored-By: siddhantCodes <siddhantk232@gmail.com>
2024-08-26 17:23:56 -04:00
Robert Hensing 88998fae74
Merge pull request #11304 from hercules-ci/repl-doc-functor
`:doc`: support `__functor`
2024-08-26 17:20:37 +02:00
tomberek 96a2ddab27
Merge pull request #10910 from hercules-ci/c-api-nix_clear_err
C API: `nix_clear_err`
2024-08-26 10:50:26 -04:00
tomberek 3b6e24f66c
Merge pull request #11346 from mjgallag/nix-profile-daemon-set-u
nix-daemon.sh profile script: operate under `set -u` in bash
2024-08-26 10:49:31 -04:00
tomberek 440de80d34
Merge pull request #11021 from hercules-ci/issue-11010
Fix SSH invocation when local SHELL misbehaves
2024-08-26 10:40:51 -04:00
Eelco Dolstra 9ff0b55d4e Add a VM test for fsync-store-paths
Based on https://github.com/squalus/nix-durability-tests/blob/master/flake.nix.
2024-08-22 15:34:19 +02:00
Eelco Dolstra 9243457cb2 Fix umount failure
Fixes

```
    umount: /tmp/nix-shell.i3xRwX/nix-test/local-overlay-store/delete-refs/stores/merged-store/nix/store: filesystem was unmounted, but failed to update userspace mount table.
make: *** [mk/lib.mk:93: tests/functional/local-overlay-store/delete-refs.sh.test] Error 16
```

in a dev shell.

Note: this previously worked before we didn't have umount in the dev
shell, so we got /run/wrappers/bin/umount.
2024-08-19 17:07:22 +02:00
Robert Hensing 2f0db04da0 tests.installer: Load profile with -o unset
Tested with an ubuntu case. Might need revision depending on what hydra
thinks of the rest.
2024-08-19 16:41:40 +02:00
Robert Hensing 9385383347 Revert "Remove unit tests from old build system"
`make check` was reverted too soon. The hacking guide wasn't brought
up to date with the new workflow, and it's not clear how to use
meson for everything.

This reverts commit 6f3045c2a2.
2024-08-19 15:18:02 +02:00
tomberek 1c5ad159d6
Merge pull request #10980 from kjeremy/flake-show-description
nix flake show: add the description if it exists
2024-08-18 16:31:44 -04:00
Robert Hensing c458598647
Merge pull request #11297 from shivaraj-bh/flake-apps-description
`nix flake show`: Support `meta` attribute for `apps`
2024-08-17 13:12:01 +02:00
shivaraj-bh 2ab93fd5fd nix flake check: Add functional tests for apps and formatter 2024-08-17 15:50:06 +05:30
Robert Hensing d4aa7d5dc7 Use nixosTest.quickBuild behavior by default
This wasn't the default behaviour because:

> We don't enable this by default to avoid the mostly unnecessary work of
> performing an additional build of the package in cases where we build
> the package normally anyway, such as in our pre-merge CI.

Since we have a componentized build, we've solved the duplication.

In the new situation, building both with and without unit tests
isn't any slow than just a build with unit tests, so there's no
point in using the unit-tested build anymore.

By using the otherwise untested build, we reduce the minimum build
time towards the NixOS test, at no cost.

If you want to run all tests, build all attributes.
2024-08-16 21:25:48 -04:00
Robert Hensing a03bb4455c Fix SSH invocation when local SHELL misbehaves
Setting it to /bin/sh will make it more predictable when users have
their favorite shell in SHELL, which might not behave as expected.
For instance, a bad rc file could send something to stdout before
our LocalCommand gets to write "started".

This may help https://github.com/NixOS/nix/issues/11010
2024-08-16 15:53:30 +02:00
Robert Hensing 72a4d1f52d Add :doc support for __functor 2024-08-15 13:04:34 +02:00
John Ericson b41cc1a755 Make wrapper derivation
This ensures just `nix build`-ing the flake doesn't forget to run all
tests. One can still specifiy specific attributes to just build one
thing.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-14 18:04:38 -04:00
John Ericson 6f3045c2a2 Remove unit tests from old build system
Now that we can run all tests with Meson, we want developers making code
changes to use it.

(Only the manual needs to be built with the build system, and that will
change shortly.)

This reverts commit b0bc2a97bf.
2024-08-14 16:38:00 -04:00
John Ericson 34fe2478a2 Build Functional tests with Meson
Co-Authored-By: Qyriad <qyriad@qyriad.me>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-14 15:35:40 -04:00
Bryan Honof cc9fe4dee7
Fix a few shellcheck tests
Ref nixos/nix#10795
2024-08-14 15:16:06 +02:00
Robert Hensing 18485d2d53
Merge pull request #11188 from lf-/jade/kill-int-overflow
Ban integer overflow in the Nix language
2024-08-11 04:24:16 +02:00
Jeremy Kolb abbaba9122 Use the window size for the entire length 2024-08-08 14:47:57 -04:00
John Ericson 6c861b9c51 Factor out lookupExecutable and other PATH improvments
This ended up motivating a good deal of other infra improvements in
order to get Windows right:

- `OsString` to complement `std::filesystem::path`

- env var code for working with the underlying `OsString`s

- Rename `PATHNG_LITERAL` to `OS_STR`

- `NativePathTrait` renamed to `OsPathTrait`, given a character template
  parameter until #9205 is complete.

Split `tests.cc` matching split of `util.{cc,hh}` last year.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-07 18:12:58 -04:00
John Ericson 9d2d4d11e6 Split tests, organize more string functions
The test split matches PR #8920, so the utility files and tests files
are once again to 1-1. The string changes continues what was started in
PR #11093.
2024-08-05 12:50:13 -04:00
John Ericson 1fce591cbc
Merge pull request #11255 from DeterminateSystems/test-s3-binary-cache-store
Add a VM test for S3BinaryCacheStore
2024-08-05 11:12:08 -05:00
Jeremy Kolb 930818bb1d Account for total length of 80 2024-08-05 11:02:56 -04:00
Jeremy Kolb f22cf1fd38 Handle long strings, embedded new lines and empty descriptions 2024-08-05 11:02:55 -04:00
Jeremy Kolb 59b6aafadb add tests 2024-08-05 11:02:55 -04:00
Eelco Dolstra 2950f9e18a Add a VM test for S3BinaryCacheStore
Fixes #11238.
2024-08-05 11:48:50 +02:00