Commit graph

11439 commits

Author SHA1 Message Date
Eelco Dolstra 076945c808
Merge pull request #5875 from hercules-ci/fix-large-drv-field-stack-overflow
Fix segfault or stack overflow caused by large derivation fields
2022-01-24 12:05:30 +01:00
regnat ffb28eaa1e Add a small documentation for hiliteMatches 2022-01-24 10:07:02 +01:00
Sandro Jäckel 040cb7304a
nix-shell: use clean rm, not any aliases/functions 2022-01-23 04:58:00 +01:00
Rok Garbas c9a4ddb9c0
Merge pull request #5829 from NixOS/push-docker-image-to-docker-hub
Push docker image to docker hub for each commit on master
2022-01-22 21:55:18 +01:00
pennae fd5aa6ee3e allocate a GC root value for the Value cache pointer
keeping it as a simple data member means it won't be scanned by the GC, so
eventually the GC will collect a cache that is still referenced (resulting in
use-after-free of cache elements).

fixes #5962
2022-01-22 21:19:56 +01:00
Florian Franzen 12578ba672 tests: skip flake search test if no git is present 2022-01-22 20:13:16 +01:00
Ross Light 7477974b93
Correct NIX_BUILD_PATH default description
Source: 067076287b/src/nix-build/nix-build.cc (L362-L381)
2022-01-21 18:45:19 -08:00
Fishhh f82a426502
Add some tests for hiliteMatches in libutil 2022-01-21 20:10:54 +01:00
Fishhh 1e0b7cdc3f
Move hilite_all into libutil and rename it to hiliteMatches
The signature was also changed so the function now accepts a vector
instead of an iterator
2022-01-21 20:10:46 +01:00
Travis A. Everett bdb5e03821 install-darwin: dodge bash 3.2 command bug
The script is trying to find chown in a cross-platform-like
way, but there's some sort of deficiency in `command -p` in
the default macOS bash 3.2. It looks like it will just use
whatever PATH is already set, instead of the "default" path.

This attempts to hard-set a PATH via `getconf PATH`. It will
just set an empty PATH if that fails for some reason. A
properly-functioning `command -p` should not care what we
set the PATH to here one way or the other.

Hopefully fixes #5768.
2022-01-21 10:47:06 -06:00
Robert Hensing 0407436b0f
derivations.cc: Use larger buffer in printString
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-21 17:25:37 +01:00
Eelco Dolstra 5f08db69d1
Merge pull request #5953 from edolstra/fix-realise-path-errors
Fix exception handling around realisePath()
2022-01-21 15:59:32 +01:00
Rok Garbas d463e11760
Adding docs regarding the docker image from master 2022-01-21 14:50:34 +01:00
Rok Garbas c79087eb2a
also tagging with latest commit with a master tag 2022-01-21 14:40:34 +01:00
Rok Garbas a078a645da
Merge remote-tracking branch 'origin/master' into push-docker-image-to-docker-hub 2022-01-21 14:31:17 +01:00
Eelco Dolstra 128098040b
Fix exception handling around realisePath()
This no longer worked correctly because 'path' is uninitialised when
an exception occurs, leading to errors like

       … while importing ''

       at /nix/store/rrzz5b1pshvzh1437ac9nkl06br81lkv-source/flake.nix:352:13:

So move the adding of the error context into realisePath().
2022-01-21 13:53:18 +01:00
Eelco Dolstra e85cf34ea3
Merge pull request #5949 from obsidiansystems/old-copyClosure
Add back `copyClosure` for plain `StorePath`s
2022-01-21 11:33:32 +01:00
Eelco Dolstra accfcfff6b
Merge pull request #5943 from NixOS/3204-fix-build-with-newer-nlohmann-json
Fix the build with nlohmann/json 3.10.4+
2022-01-21 11:31:39 +01:00
Eelco Dolstra c7223db871
Merge pull request #5942 from NixOS/5912-quieter-nix-why-depends
Make `nix why-depends` quieter by default
2022-01-21 10:18:28 +01:00
Théophane Hufschmitt fa53250c36
Improve the description of the --precise option
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2022-01-21 09:52:40 +01:00
John Ericson 5ee937523d Add back copyClosure for plain StorePaths
This was removed in 2e199673a5 when
`copyPath` transitioned to use `RealisedPath`. But then in
e9848beca7 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-20 20:57:44 +00:00
Hubert Głuchowski b03fe13b5b
Add some tests for multiple regex/match highlighting in nix search 2022-01-20 18:18:07 +01:00
Hubert Głuchowski 9510ad10c5
Make hilite_all take an iterator of matches instead of a vector. 2022-01-20 17:12:15 +01:00
Théophane Hufschmitt 067076287b
Merge pull request #5946 from obsidiansystems/delete-dead-code
Remove dead field in NixArgs
2022-01-20 06:13:11 +01:00
John Ericson 89f8917a32 Remove dead field in NixArgs
This has been unused since 170e86dff5

CC @thufschmitt
2022-01-19 20:26:14 +00:00
Hubert Głuchowski 87fdd23025
Make nix search highlight all matches of a regex 2022-01-19 20:45:31 +01:00
Hubert Głuchowski 92e8230215
Make nix search highlight all regexes 2022-01-19 19:08:02 +01:00
Robert Hensing dec7748119 Replace withBuffer by boost small_vector
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-19 15:21:56 +01:00
Robert Hensing 624f18ad90 withBuffer: Make sure to hit the stack protector 2022-01-19 15:21:56 +01:00
Robert Hensing 6dd271b7b4 withBuffer: avoid allocating a std::function 2022-01-19 15:21:56 +01:00
Robert Hensing 55c58580be Add withBuffer
... to avoid non-standard, unidiomatic alloca.
2022-01-19 15:21:56 +01:00
Robert Hensing d038a67bd3 Fix segfault or stack overflow caused by large derivation fields
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-19 15:21:56 +01:00
regnat e36add56cf Fix the build with nlohmann/json 3.10.4+ 2022-01-19 14:37:54 +01:00
regnat dd7c2e0695 Make nix why-depends quieter by default
Unless `--precise` is passed, make `nix why-depends` only show the
dependencies between the store paths, without introspecting them to
find the actual references.

This also makes it ~3x faster
2022-01-19 14:24:14 +01:00
Eelco Dolstra bc443511eb
Merge pull request #5905 from lincolnauster/flake-update-custom-commit
Custom commit messages when commiting the lockfile
2022-01-19 10:05:27 +01:00
lincoln auster [they/them] 7d4f86f032 release-notes: document commit-lockfile-summary option
This documents 3023c7700.
2022-01-18 16:10:44 -07:00
lincoln auster [they/them] 3e5a9ad7ff allow modifying lockfile commit msg with nix config option
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-18 16:10:27 -07:00
Eelco Dolstra 4af88a4c91
Merge pull request #5906 from pennae/primops-optimization
optimize primops and utils by caching more and copying less
2022-01-18 19:43:28 +01:00
Eelco Dolstra 9901cb96c7
Merge pull request #5918 from tweag/tty-logs
Print build logs when not connected to a TTY
2022-01-18 19:42:01 +01:00
Eelco Dolstra d6e3fbc6f5
Merge pull request #5929 from edolstra/copy-logs
Add command to copy build logs between stores
2022-01-18 19:41:10 +01:00
Eelco Dolstra 04432f2510 Add examples 2022-01-18 17:37:04 +01:00
Eelco Dolstra 5fe1ec8a05 Add a test for 'nix store copy-log' and 'nix log' 2022-01-18 17:30:50 +01:00
Eelco Dolstra 3876238546 Add Installable::toDrvPaths()
This is needed to get the path of a derivation that might not exist
(e.g. for 'nix store copy-log').

InstallableStorePath::toDerivedPaths() cannot be used for this because
it calls readDerivation(), so it fails if the store doesn't have the
derivation.
2022-01-18 17:28:18 +01:00
regnat 2ad2678c0b Add a simple test for nix why-depends 2022-01-18 16:54:53 +01:00
Eelco Dolstra 5b243a2b4b BinaryCacheStore: Implement addBuildLog() 2022-01-18 16:14:01 +01:00
Eelco Dolstra 4dda1f92aa Add command 'nix store copy-log'
Fixes #5222.
2022-01-18 14:08:49 +01:00
Eelco Dolstra 6448ea84ab Factor out --from / --to logic 2022-01-18 14:08:49 +01:00
Eelco Dolstra f6f0bcf11f
Doh 2022-01-18 14:06:51 +01:00
Eelco Dolstra 50be51d9a8 Doh 2022-01-18 13:50:25 +01:00
Eelco Dolstra 3157028fc1
Merge pull request #5932 from edolstra/remove-shared-strings
Remove shared strings
2022-01-18 11:14:18 +01:00