Commit Graph
65 Commits
Author SHA1 Message Date
Yorick van Pelt e78e9a6bd1 SimpleLogger::log: fix unintended fallthrough 2023-08-11 12:05:45 +02:00
Yorick van Pelt 2e5096e4f0 FileTransfer::download: fix use-after-move
std::move(state->data) and data.empty() were called in a loop, and
could run with no other threads intervening. Accessing moved objects
is undefined behavior, and could cause a crash.
2023-08-11 12:00:31 +02:00
Yorick van Pelt 1ffb26311b MultiCommand::toJSON: Fix use-after-move 2023-08-11 12:00:11 +02:00
Yorick van Pelt b9b51f9579 Prevent overriding virtual methods that are called in a destructor
Virtual methods are no longer valid once the derived destructor has
run. This means the compiler is free to optimize them to be
non-virtual.

Found using clang-tidy
2023-08-11 11:58:33 +02:00
Yorick van Pelt 2c462486fe create pathAccessible, use it to infer default dirs 2023-05-26 15:36:47 +02:00
Yorick van Pelt a6c78ba367 getDefaultNixPath: ignore EPERM 2023-05-26 15:36:46 +02:00
Yorick van Pelt b7cde90c6b Call getDefaultSSLCertFile() only when none is specified
This does pathExists on various paths, which crashes on EPERM in the
macOS sandbox.
2023-05-26 15:36:45 +02:00
Yorick van Pelt d1ff33d2d6 tests/post-hook: remove TODO and --derivation upload 2023-05-08 12:58:59 +02:00
Yorick van Pelt 5e332aa503 tests: copying only the out paths is not enough information for CA 2023-05-08 12:58:59 +02:00
Yorick van Pelt 12685ef45f CA: rewrite hashes for all outputs, not just the wanted ones 2023-05-08 12:58:59 +02:00
Yorick van Pelt 2ca2c80c4e libstore: also pass unwanted outputs to the post-build-hook 2023-05-08 12:58:59 +02:00
Yorick van Pelt 869fb1a2f6 tests/post-hook: test to see if all outputs are passed
fe5509df caused only wanted outputs to be passed to the
post-build-hook, which resulted in paths being built
without ever going into the hook.

This commit adds a (currently failing) test for this.
2023-05-08 12:43:56 +02:00
Yorick van PeltandThéophane Hufschmitt 62ddd8633c Add talkative msg for coro gc debug 2023-04-07 14:54:50 +02:00
Yorick van PeltandThéophane Hufschmitt 58d24a4cb6 Always disable GC in a coroutine unless the patch is applied 2023-04-07 14:54:38 +02:00
Yorick van PeltandThéophane Hufschmitt 00bc34430b DisableGC: replace by CoroutineContext, std::shared_ptr<void> 2023-04-07 14:53:40 +02:00
Yorick van PeltandThéophane Hufschmitt 2c53ef1bfe Disable GC inside coroutines on mac OS 2023-04-07 14:52:59 +02:00
Yorick van Pelt 2683734936 Add talkative msg for coro gc debug 2023-03-03 11:43:47 +01:00
Yorick van Pelt 5bb6e3bfaf NixRepl::mainLoop: restore old curRepl on function exit
This fixes completion callbacks after entering and leaving a nested
debugger.
2023-03-02 17:24:58 +01:00
Yorick van Pelt 176005749c Always disable GC in a coroutine unless the patch is applied 2023-03-01 15:07:00 +01:00
Yorick van Pelt 4c73eab923 DisableGC: replace by CoroutineContext, std::shared_ptr<void> 2023-03-01 13:55:41 +01:00
Yorick van Pelt 53bb4a5327 tests/coro-gc: refactor and split into 3 tests 2023-03-01 13:55:41 +01:00
Yorick van Pelt eaeb994d8b Disable GC inside coroutines on mac OS 2023-03-01 13:55:41 +01:00
Yorick van Pelt 0fd8f542a8 tests/coro-gc: create test for boehm stack patch
Regression test for #7679
2023-03-01 13:55:37 +01:00
Yorick van Pelt ae5082bbba tests/fetchGit: add regression test for #7707 2023-02-27 15:33:54 +01:00
Yorick van Pelt 2c0866fc3f fetchTree: convert fs path to url via ParsedURL::to_string 2023-02-27 15:30:04 +01:00
Yorick van Pelt 0844856c84 url: make percentEncode stricter, expose and unit test it 2023-02-27 15:30:00 +01:00
Yorick van Pelt bbba49b3e4 Wait with making /etc unwritable until after build env setup
This fixes /etc/nsswitch.conf
2023-02-17 16:34:45 +01:00
Yorick van Pelt 49fd72a903 Make /etc writability conditional on uid-range feature 2023-02-14 13:55:41 +01:00
Yorick van Pelt ad1f61c39b container test: make /etc writable 2023-02-14 12:26:40 +01:00
Yorick van Pelt db41f74af3 Don't allow writing to /etc 2023-02-14 12:03:34 +01:00
f2e427942d Improve hacking.md
- Refer to current version in readme
- Split into flakes and non-flakes section
- Change order to move nix-build to the end, since people often start
  with it in the beginning.
- Use proper "Note" syntax
- Add notes about editor integration
- Move information about target platforms and stdenvs into separate
  sections

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Alexander Bantyev <alexander.bantyev@tweag.io>
Co-authored-by: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
2023-02-13 12:00:00 +04:00
Yorick van PeltandAlexander Bantyev 012ddaa322 flake.nix: add clangd and bear 2023-02-10 14:29:59 +04:00
Yorick van Pelt 631ba6442a build-remote: store maxBuildJobs before forcing it to 1 2023-02-07 12:08:00 +01:00
Yorick van Pelt 3050005211 build-remote: don't warn when all local build slots are taken
Previously, build-remote would show a warning if all build slots were
taken, even if they would open up later. This caused a lot of spam in
the logs. Disable this warning when maxJobs > 0.

See #6263
2023-02-06 17:53:03 +01:00
Yorick van Pelt 4757b3f04e tests/store-ping: test nix store ping --json 2023-01-31 15:10:54 +01:00
Yorick van Pelt 4f4a6074e4 nix store ping: try to print json if connect() fails aswell 2023-01-31 15:10:39 +01:00
Yorick van Pelt 28648ed784 nix store ping: add --json flag 2023-01-31 13:24:23 +01:00
Yorick van Pelt 09f00dd4d0 Replace src/libutil/json.cc with nlohmann json generation 2022-11-16 16:50:50 +01:00
Yorick van Pelt 16f1720fd2 SourceExprCommand: swallow EvalError, add tests for this
Completing things that would error would print an ugly error in
the middle of your command line. Avoid printing this error.
2022-11-03 10:11:28 +01:00
Yorick van Pelt 444af85552 Temporarily disable the debugger during completion evaluation
readline is not re-entrant, so entering the debugger from the
completioncallback results in an eventual segfault.

The workaround is to temporarily disable the debugger when searching
for possible completions.
2022-11-02 13:02:24 +01:00
Yorick van Pelt 34ea0e2e7b tarfile: set directory mode to at least 0500, don't extract fflags
We don't need SGID, or any ACL's. We also want to keep every dir +rx.
2022-11-01 16:01:38 +01:00
Yorick van Pelt aff6d10934 nix run: fix "'defaultApp.x86_64-linux' should have type 'derivation'" 2022-10-26 10:05:27 +02:00
Yorick van Pelt 7e52472759 configure.ac: don't run sandbox-shell test when cross compiling 2022-05-24 17:00:27 +02:00
Yorick van Pelt cbf60bec6f configure.ac: check for sandbox-shell's FEATURE_SH_STANDALONE
See also: https://bugs.archlinux.org/task/73998. Busybox's
FEATURE_SH_STANDALONE feature causes other busybox applets to
leak into the sandbox, where system() calls will start preferring
them over tools in $PATH. On arch, this even includes `ar`.

Let's check for this evil feature and disallow using this as a
sandbox shell.
2022-05-24 16:26:40 +02:00
Yorick van Pelt ebf2fd76b1 Add custom to_json and from_json functions for ExperimentalFeature
nix show-config --json was serializing experimental features as ints.
nlohmann::json will automatically use these definitions to serialize
and deserialize ExperimentalFeatures.

Strictly, we don't use the from_json instance yet, it's provided for
completeness and hopefully future use.
2022-04-20 15:41:01 +02:00
Yorick van Pelt a4ab0a74d9 Fix accidental O(n^2 * log n) performance in NixRepl::addAttrsToScope
Only sort once, after adding all of the attrs first. This reduces my
`nix repl '<nixpkgs>'` loading time from 1.07s to 103ms.

Fixes #5823
2021-12-27 13:18:55 +01:00
Yorick van Pelt 33e96820d5 EvalCommand::getEvalState: use gc tracable allocator for EvalState 2021-12-11 16:02:08 +01:00
Yorick van Pelt 0e0de90b35 extract_archive: fix "Hard-link target '...'" error
Fixes #5741
2021-12-10 17:03:51 +01:00
Yorick van Pelt be1055f2cc extract_archive: use copy_pathname instead of set_pathname.
Libarchive documentation mentions that archive_entry_set_pathname
expects us to keep the passed string alive, which we don't.
2021-12-10 17:00:32 +01:00
Yorick van Pelt bd628cf3da flakes: fix boolean and int nixConfig values
Some type confusion was causing ints to be pointers, and bools
to be ints. Fixes #5621
2021-11-29 15:53:22 +01:00
Yorick van Pelt fcb8af550f Restore parent mount namespace in restoreProcessContext
This ensures any started processes can't write to /nix/store (except
during builds). This partially reverts 01d07b1e, which happened because
of #2646.

The problem was only happening after nix downloads anything, causing
me to suspect the download thread. The problem turns out to be:
"A  process  can't  join a new mount namespace if it is sharing
filesystem-related attributes with another process", in this case this
process is the curl thread.

Ideally, we might kill it before spawning the shell process, but it's
inside a static variable in the getFileTransfer() function. So
instead, stop it from sharing FS state using unshare(). A strategy
such as the one from #5057 (single-threaded chroot helper binary) is
also very much on the table.

Fixes #4337.
2021-10-15 16:25:49 +02:00
Yorick van PeltandLars Jellema 8a0c00b856 Use libarchive for all compression 2021-03-10 22:34:29 +01:00
Yorick van Pelt a350d0beb0 json-to-value: use unique_ptr instead of raw pointers 2020-01-09 22:46:41 +01:00
Yorick van Pelt f1fac0b5c3 builtins.fromJSON: use nlohmann/json parser instead of custom parser 2020-01-09 17:38:27 +01:00
Yorick van Pelt f765e44123 downgrade required libarchive version (ubuntu 16.04) 2019-12-09 18:39:37 +07:00
Yorick van Pelt 3663a8a7e9 release.nix: add libarchive to rpm and deb dependencies 2019-12-09 17:31:05 +07:00
Yorick van Pelt b232eea40a nix-rust: remove unused tar file code 2019-12-09 17:28:15 +07:00
Yorick van Pelt eba82b7c88 further clean up libarchive code 2019-12-09 17:21:46 +07:00
Yorick van Pelt fe7ec70e6b remove rust unpack_tarfile ffi 2019-12-07 23:28:31 +07:00
Yorick van Pelt 1355554d12 code 'cleanup' 2019-12-07 23:23:11 +07:00
Yorick van Pelt f54c168031 add wrapper function around libarchive to c++ errors 2019-12-07 23:10:27 +07:00
Yorick van Pelt 232b390766 fixup! libarchive proof of concept 2019-12-07 23:00:37 +07:00
Yorick van Pelt 9ff5f6492f libarchive proof of concept 2019-12-07 22:35:14 +07:00
Yorick van Pelt 72a78beb34 Fix #2162: use getaddrinfo instead of curl to preload NSS 2018-06-12 13:05:14 +02:00
Yorick van Pelt b9289e4855 make sure not to use cached channels for nix-channel --update
fixes #1964
2018-05-09 16:18:20 +02:00