aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
AgeCommit message (Collapse)Author
2022-03-07Merge pull request #6029 from Ma27/nix-log-ssh-ngThéophane Hufschmitt
ssh-ng: also store build logs to make them accessible by `nix log`
2022-03-03Factor out a `GcStore` interfaceJohn Ericson
Starts progress on #5729. The idea is that we should not have these default methods throwing "unimplemented". This is a small step in that direction. I kept `addTempRoot` because it is a no-op, rather than failure. Also, as a practical matter, it is called all over the place, while doing other tasks, so the downcasting would be annoying. Maybe in the future I could move the "real" `addTempRoot` to `GcStore`, and the existing usecases use a `tryAddTempRoot` wrapper to downcast or do nothing, but I wasn't sure whether that was a good idea so with a bias to less churn I didn't do it yet.
2022-03-03Fix segfault in headerCallback()Eelco Dolstra
https://hydra.nixos.org/build/168594664
2022-03-01Move `BuildResult` defintion to its own headerJohn Ericson
Just like we did for `ValidPathInfo` in d92d4f85a5c8a2a2385c084500a8b6bd54b54e6c.
2022-03-01Move some stuff from `Settings` to a new `FetchSettings`.John Ericson
Starting work on #5638 The exact boundary between `FetchSettings` and `EvalSettings` is not clear to me, but that's fine. First lets clean out `libstore`, and then worry about what, if anything, should be the separation between those two.
2022-02-28libstore/build: add a few explanatory comments; simplifyMaximilian Bosch
2022-02-28libstore/derivation-goal: avoid double-parsing of JSON messagesMaximilian Bosch
To avoid that JSON messages are parsed twice in case of remote builds with `ssh-ng://`, I split up the original `handleJSONLogMessage` into three parts: * `parseJSONMessage(const std::string&)` checks if it's a message in the form of `@nix {...}` and tries to parse it (and prints an error if the parsing fails). * `handleJSONLogMessage(nlohmann::json&, ...)` reads the fields from the message and passes them to the logger. * `handleJSONLogMessage(const std::string&, ...)` behaves as before, but uses the two functions mentioned above as implementation. In case of `ssh-ng://`-logs the first two methods are invoked manually.
2022-02-28ssh-ng: also store build logs to make them accessible by `nix log`Maximilian Bosch
Right now when building a derivation remotely via $ nix build -j0 -f . hello -L --builders 'ssh://builder' it's possible later to read through the entire build-log by running `nix log -f . hello`. This isn't possible however when using `ssh-ng` rather than `ssh`. The reason for that is that there are two different ways to transfer logs in Nix through e.g. an SSH tunnel (that are used by `ssh`/`ssh-ng` respectively): * `ssh://` receives its logs from the fd pointing to `builderOut`. This is directly passed to the "log-sink" (and to the logger on each `\n`), hence `nix log` works here. * `ssh-ng://` however expects JSON-like messages (i.e. `@nix {log data in here}`) and passes it directly to the logger without doing anything with the `logSink`. However it's certainly possible to extract log-lines from this format as these have their own message-type in the JSON payload (i.e. `resBuildLogLine`). This is basically what I changed in this patch: if the code-path for `builderOut` is not reached and a `logSink` is initialized, the message was successfully processed by the JSON logger (i.e. it's in the expected format) and the line is of the expected type (i.e. `resBuildLogLine`), the line will be written to the log-sink as well. Closes #5079
2022-02-28Fix clang warningEelco Dolstra
2022-02-28Fix Darwin buildEelco Dolstra
Fixes #6169
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2022-02-25refactor: remove verbose-build from docsKevin Amado
- From what I see it is an implementation detail but is no longer configurable from the settings
2022-02-21Remove std::string aliasEelco Dolstra
2022-02-21Remove std::set aliasEelco Dolstra
2022-02-21Remove std::list aliasEelco Dolstra
2022-02-19path-info: use full store paths when we have themLinus Heckemann
Fixes #5645
2022-02-16addToStoreFromDump(): Take std::string_viewEelco Dolstra
2022-02-12Fix using sandbox without user namespacesSebastian Ullrich
2022-02-07Fix 'basic_string::_M_construct null not valid' in interrupted downloadEelco Dolstra
Fixes #5985.
2022-02-02Merge branch 'more-stringviews' of https://github.com/pennae/nixEelco Dolstra
2022-01-30fix spelling mistakes reported by Debian's lintian toolThomas Koch
2022-01-27return string_views from forceString*pennae
once a string has been forced we already have dynamic storage allocated for it, so we can easily reuse that storage instead of copying.
2022-01-27convert a for more utilities to string_viewpennae
2022-01-25nix store ping: Report Nix daemon versionEelco Dolstra
Fixes #5952.
2022-01-24Merge pull request #5875 from hercules-ci/fix-large-drv-field-stack-overflowEelco Dolstra
Fix segfault or stack overflow caused by large derivation fields
2022-01-21derivations.cc: Use larger buffer in printString Robert Hensing
If we want to be careful about hitting the stack protector page, we should use `-fstack-check` instead. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2022-01-21Merge pull request #5949 from obsidiansystems/old-copyClosureEelco Dolstra
Add back `copyClosure` for plain `StorePath`s
2022-01-20Add back `copyClosure` for plain `StorePath`sJohn Ericson
This was removed in 2e199673a523fa81de31ffdd2a25976ce0814631 when `copyPath` transitioned to use `RealisedPath`. But then in e9848beca704d27a13e28b4403251725bd485bb2 we added it back just for `realisedPath`. I think it is a good utility function --- one can easily imagine it becoming optimized in the future, and copying paths *violating* the closure is a very niche feature. So if we have `copyPaths` for both sorts of paths, I think we should have `copyClosure` for both sorts too.
2022-01-19Replace withBuffer by boost small_vectorRobert Hensing
Although this will leave gaps in the stack, the performance impact of those should be insignificant and we get a simpler solution this way.
2022-01-19withBuffer: avoid allocating a std::functionRobert Hensing
2022-01-19Add withBufferRobert Hensing
... to avoid non-standard, unidiomatic alloca.
2022-01-19Fix segfault or stack overflow caused by large derivation fieldsRobert Hensing
This removes a dynamic stack allocation, making the derivation unparsing logic robust against overflows when large strings are added to a derivation. Overflow behavior depends on the platform and stack configuration. For instance, x86_64-linux/glibc behaves as (somewhat) expected: $ (ulimit -s 20000; nix-instantiate tests/lang/eval-okay-big-derivation-attr.nix) error: stack overflow (possible infinite recursion) $ (ulimit -s 40000; nix-instantiate tests/lang/eval-okay-big-derivation-attr.nix) error: expression does not evaluate to a derivation (or a set or list of those) However, on aarch64-darwin: $ nix-instantiate big-attr.nix ~ zsh: segmentation fault nix-instantiate big-attr.nix This indicates a slight flaw in the single stack protection page approach that is not encountered with normal stack frames.
2022-01-19Fix the build with nlohmann/json 3.10.4+regnat
2022-01-18allow modifying lockfile commit msg with nix config optionlincoln auster [they/them]
This allows setting the commit-lockfile-summary option to a non-empty string to override the commit summary while leaving the body unchanged.
2022-01-18BinaryCacheStore: Implement addBuildLog()Eelco Dolstra
2022-01-18Add command 'nix store copy-log'Eelco Dolstra
Fixes #5222.
2022-01-18DohEelco Dolstra
2022-01-18DohEelco Dolstra
2022-01-18Get rid of std::shared_ptr<std::string> and ref<std::string>Eelco Dolstra
These were needed back in the pre-C++11 era because we didn't have move semantics. But now we do.
2022-01-17serialise.hh: Use std::string_viewEelco Dolstra
2022-01-11Merge pull request #5898 from layus/repair-path-linksEelco Dolstra
Make --repair-path also repair corrupt optimised links
2022-01-11Prefer RepairFlag over bool when applicableGuillaume Maudoux
2022-01-11Make --repair-path also repair corrupt optimised linksGuillaume Maudoux
There already existed a smoke test for the link content length, but it appears that there exists some corruptions pernicious enough to replace the file content with zeros, and keeping the same length. --repair-path now goes as far as checking the content of the link, making it true to its name and actually repairing the path for such coruption cases.
2022-01-10'target' points to 'source'Eelco Dolstra
2022-01-10Merge branch 'recursive-nix-fix' of https://github.com/L-as/nixEelco Dolstra
2022-01-07DerivationGoal::loadDerivation(): Don't use derivationFromPath()Eelco Dolstra
This causes a recursive call to ensurePath(), which is not a good idea.
2022-01-06Merge pull request #5749 from GavinRay97/patch-1Domen Kožar
Better diagnostics if no valid signature found
2021-12-22Remove CPU lockingEelco Dolstra
This was already accidentally disabled in ba87b08. It also no longer appears to be beneficial, and in fact slow things down, e.g. when evaluating a NixOS system configuration: elapsed time: median = 3.8170 mean = 3.8202 stddev = 0.0195 min = 3.7894 max = 3.8600 [rejected, p=0.00000, Δ=0.36929±0.02513]
2021-12-16Ignore EPERM when unsharing FS stateEelco Dolstra
On Docker (but not podman), unshare(CLONE_FS) fails with EPERM. So let's ignore it and hope nothing bad happens. Attempted fix for #5777.
2021-12-14Merge pull request #5769 from NixOS/ca/get-build-statsEelco Dolstra
Add a crude tracing mechansim for the build results