John Ericson
f6f01416b7
Use std::string_view
in a few more places
2020-06-12 21:32:30 +00:00
Eelco Dolstra
2853ba4ab2
Fix build
2020-06-12 19:00:48 +02:00
Eelco Dolstra
00fa7e2205
Merge pull request #3674 from matthewbauer/allow-empty-hash2
...
Allow empty hash in derivations
2020-06-12 18:18:12 +02:00
Matthew Bauer
ea0d29d99a
Provide base argument to to_string
2020-06-12 10:18:27 -05:00
Matthew Bauer
b260c9ee03
Add newHashAllowEmpty helper function
...
This replaces the copy&paste with a helper function in hash.hh.
2020-06-12 10:11:16 -05:00
Eelco Dolstra
9f736dd89d
Add Store::readDerivation() convenience function
2020-06-12 13:04:52 +02:00
Eelco Dolstra
045b07200c
Remove Store::queryDerivationOutputNames()
...
This function was used in only one place, where it could easily be
replaced by readDerivation() since it's not
performance-critical. (This function appears to have been modelled
after queryDerivationOutputs(), which exists only to make the garbage
collector faster.)
2020-06-12 12:46:33 +02:00
Eelco Dolstra
4a4c063222
Merge pull request #3670 from gilligan/add-pool-tests
...
Add tests for pool.hh
2020-06-12 11:19:05 +02:00
Ben Burdette
ef1b3f21b6
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-06-11 14:06:35 -06:00
Eelco Dolstra
ac4d43a31b
Merge pull request #3073 from tweag/machine-logs
...
Add an option to print the logs in a machine-readable format
2020-06-11 15:45:18 +02:00
Eelco Dolstra
dd9bb11d0d
Move names.{cc,hh} to libstore
2020-06-11 15:42:18 +02:00
Eelco Dolstra
95eb064062
Shut up warning
2020-06-11 15:39:30 +02:00
Eelco Dolstra
8bd892117a
Style fixes
2020-06-11 15:39:08 +02:00
Tobias Pflug
4750d98bbd
Add tests for pool.hh
2020-06-10 22:29:50 +02:00
Eelco Dolstra
b9ae1bdd7a
Merge pull request #3655 from zimbatm/hash-encoding-prepare
...
libutils/hash: remove default encoding
2020-06-10 11:48:38 +02:00
Matthew Bauer
b2c8061b44
Disable extra-platforms = i686-linux on wsl1 ( #3676 )
...
WSL1 doesn’t support i686-linux emulation, see https://github.com/microsoft/wsl/issues/2468
2020-06-09 21:53:53 +00:00
Matthew Bauer
19aa892f20
Support empty hash in fetchers
...
fetchTarball, fetchTree, and fetchGit all have *optional* hash attrs.
This means that we need to be careful with what we allow to avoid
accidentally making these defaults. When ‘hash = ""’ we assume the
empty hash is wanted.
2020-06-09 11:10:54 -05:00
Matthew Bauer
762273f1fd
Allow empty hash in derivations
...
follow up of https://github.com/NixOS/nix/pull/3544
This allows hash="" so that it can be used for debugging purposes. For
instance, this gives you an error message like:
warning: found empty hash, assuming you wanted 'sha256:0000000000000000000000000000000000000000000000000000'
hash mismatch in fixed-output derivation '/nix/store/asx6qw1r1xk6iak6y6jph4n58h4hdmbm-nix':
wanted: sha256:0000000000000000000000000000000000000000000000000000
got: sha256:0fpfhipl9v1mfzw2ffmxiyyzqwlkvww22bh9wcy4qrfslb4jm429
2020-06-09 01:23:37 -05:00
Ben Burdette
2f19650768
add file origin to Pos in stests
2020-06-08 11:21:17 -06:00
Ben Burdette
b1c53b034c
Merge branch 'errors-phase-2' into caveman-LOCs
2020-06-08 11:10:13 -06:00
regnat
801112de1a
Move progress-bar.cc to libmain
...
Needed so that we can include it as a logger in loggers.cc without
adding a dependency on nix
This also requires moving names.hh to libutil to prevent a circular
dependency between libmain and libexpr
2020-06-08 17:16:52 +02:00
Eelco Dolstra
c27f92698b
Style fixes
2020-06-08 13:24:01 +02:00
Tobias Pflug
cd6dbf951a
Add compression unit tests
2020-06-08 11:34:37 +02:00
regnat
4983401440
Unify the printing of the logs between bar-with-logs and raw
...
Make the printing of the build logs systematically go through the
logger, and replicate the behavior of `no-build-output` by having two
different loggers (one that prints the build logs and one that doesn't)
2020-06-08 09:31:15 +02:00
regnat
170e86dff5
Make the logger customisable
...
Add a new `--log-format` cli argument to change the format of the logs.
The possible values are
- raw (the default one for old-style commands)
- bar (the default one for new-style commands)
- bar-with-logs (equivalent to `--print-build-logs`)
- internal-json (the internal machine-readable json format)
2020-06-08 09:31:15 +02:00
Ben Burdette
94c347577e
set verbosity levels
2020-06-07 07:24:49 -06:00
Tobias Pflug
e60747b5fb
Remove error-demo/error-demo.cc
...
The logging.hh superseeds the demo
2020-06-06 10:23:12 +02:00
Tobias Pflug
952e72c804
Add tests for logging.hh
2020-06-06 10:22:32 +02:00
Eelco Dolstra
d558fb98f6
Merge pull request #3656 from obsidiansystems/handle-unknown-file-ingestion
...
Add error message when FileIngestionMethod is out of bounds
2020-06-05 17:18:12 +02:00
Eelco Dolstra
39e84c35d0
Fix log-prefix of nix build -L
...
Alternative fix to #3661 . The cause was that 'name' is a
std::string_view into a temporary which could get overwritten.
2020-06-05 10:45:05 +02:00
Carlo Nucera
d614166cb6
Fix condition error and make test suite pass
2020-06-04 17:21:21 -04:00
John Ericson
e5cc1ebc5d
Merge remote-tracking branch 'upstream/master' into no-stringly-typed-derivation-output
2020-06-04 21:04:35 +00:00
John Ericson
a7b82fd006
Remove file which shouldn't be committed
2020-06-04 21:04:20 +00:00
John Ericson
94ddea9e2f
Use readString
rather than >> temporary
...
Fixed the rest of these before, but this one slipped through.
2020-06-04 20:55:08 +00:00
John Ericson
744ce9ce16
Merge branch 'master' of github.com:NixOS/nix into validPathInfo-ca-proper-datatype
2020-06-04 20:46:58 +00:00
John Ericson
2041499b5e
Flip boolean
...
Thanks Matt!
2020-06-04 20:42:25 +00:00
John Ericson
ed86acf02a
Use some std::optional::has_value
for clarity
2020-06-04 20:42:02 +00:00
John Ericson
574d5460f0
Make sure info.ca tag bit is set in nix add-to-store
2020-06-04 20:33:28 +00:00
Ben Burdette
94427ffee3
add some comments
2020-06-04 11:53:19 -06:00
Matthew Bauer
2299ef705c
Add error message when FileIngestionMethod is out of bounds
...
bool coerces anything >0 to true, but in the future we may have other
file ingestion methods. This shows a better error message when the
“recursive” byte isn’t 1.
2020-06-04 11:32:39 -05:00
Eelco Dolstra
0f44b60e6d
Make 'nix dev-shell' a deprecated alias for 'nix develop'
2020-06-04 11:14:19 +02:00
Eelco Dolstra
61e3d598b6
Rename 'nix dev-shell' to 'nix develop'
...
Fixes #3648 .
2020-06-04 10:57:40 +02:00
John Ericson
53bc8ff152
No C++ designated initializers yet with Clang 7
2020-06-03 20:45:14 -04:00
Ben Burdette
4335ba999b
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-06-03 17:00:00 -06:00
Ben Burdette
f97576c5d9
newline-as-prefix; no final newline in output.
2020-06-03 14:47:00 -06:00
Carlo Nucera
132d6f2c24
Clarify the description of StorePath construction
2020-06-03 16:08:32 -04:00
zimbatm
6ee03b8444
libutils/hash: remove default encoding
...
This will make it easier to reason about the hash encoding and switch to
SRI everywhere where possible.
2020-06-03 13:49:51 +02:00
John Ericson
01572c2198
Missing #include <cassert>
in lru-cache.hh
( #3654 )
...
This was a latent bug that just appeared because of the tests that were
added. Remember to wait for CI! :)
2020-06-03 10:15:22 +00:00
John Ericson
3c78ac348c
Merge remote-tracking branch 'obsidian/no-hash-type-unknown' into validPathInfo-ca-proper-datatype
2020-06-03 04:44:24 +00:00
John Ericson
fecff16a6e
Merge remote-tracking branch 'obsidian/missing-include-0' into validPathInfo-ca-proper-datatype
2020-06-02 23:23:30 +00:00
John Ericson
39ba87be9b
Missing #include <cassert>
in lru-cache.hh
...
This was a latent bug that just appeared because of the tests that were
added. Remember to wait for CI! :)
2020-06-02 21:36:53 +00:00
John Ericson
406dbb7fce
outputHashAlgo
can be blank so parse accordingly
...
It is blank for SRI hashes.
2020-06-02 21:09:15 +00:00
John Ericson
1fcd3afc38
Fix hashes
2020-06-02 20:35:17 +00:00
Carlo Nucera
75d2581390
Typo
2020-06-02 16:21:18 -04:00
Carlo Nucera
78f137e931
Validate text version instead, throw Errors
2020-06-02 16:20:22 -04:00
Carlo Nucera
a5cdf1867e
Add assertions for SHA256 in fixed case
2020-06-02 16:13:08 -04:00
Carlo Nucera
fd2eb41e64
Move file-hash to content-address
2020-06-02 15:44:58 -04:00
Carlo Nucera
343c20a404
WIP Completed implementation
2020-06-02 15:23:21 -04:00
John Ericson
c664e68b87
Fix to-base --type handler to correctly set std::optional flag
...
Now that we have a separate flag function, also describe why it is
optional.
2020-06-02 18:25:32 +00:00
Carlo Nucera
390bf64858
WIP
2020-06-02 14:15:58 -04:00
John Ericson
c502119fd3
to-base supports parsing SRI hashes, so make type flag optional
2020-06-02 18:05:26 +00:00
John Ericson
a33270ce1d
Clean up ValidPathInfo::isContentAddressed
with std::visit
2020-06-02 17:04:21 +00:00
John Ericson
25e61812f3
Apply suggestions from code review
...
Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
2020-06-02 12:47:18 -04:00
John Ericson
d73dbc8e4c
Remove hashingWithUnknownAlgoExits
...
A valid hash type must be provided now. The hash itself can still be
invalid, but that doesn't cause an `abort()`.
2020-06-02 16:28:54 +00:00
John Ericson
64cffb804a
Merge remote-tracking branch 'upstream/master' into no-hash-type-unknown
2020-06-02 16:07:25 +00:00
John Ericson
450dcf2c1b
Remove HashType::Unknown
...
Instead, `Hash` uses `std::optional<HashType>`. In the future, we may
also make `Hash` itself require a known hash type, encoraging people to
use `std::optional<Hash>` instead.
2020-06-02 15:52:13 +00:00
Carlo Nucera
a5d820a0a3
Change parseCa(Opt) to parseContentAddress(Opt)
2020-06-02 11:00:10 -04:00
Ben Burdette
156d4f8bc8
remove extra space in SysErrors
2020-06-02 08:45:37 -06:00
John Ericson
1b6461f671
Merge remote-tracking branch 'upstream/master' into validPathInfo-ca-proper-datatype
2020-06-02 14:31:18 +00:00
Ben Burdette
d82d230b40
elide the 'ErrorInfo' in logError and logWarning calls
2020-06-02 08:22:24 -06:00
Eelco Dolstra
bfa1acd85c
Merge pull request #3639 from obsidiansystems/do-fixme-store-removes
...
Remove `addToStore` variant as requested by `FIXME`
2020-06-02 15:39:07 +02:00
Eelco Dolstra
c16fdda3a6
Merge branch 'lru-tests' of https://github.com/gilligan/nix
2020-06-02 12:07:48 +02:00
Eelco Dolstra
e9fee8e6a7
src/libutil/tests/lru-cache.cc: Check erase()
...
Co-authored-by: James Lee <jbit@jbit.net>
2020-06-02 12:06:59 +02:00
John Ericson
efcd30da89
WIP
2020-06-02 00:37:43 +00:00
John Ericson
754c910953
WIP more progress
2020-06-01 19:26:40 -04:00
Carlo Nucera
da39092a39
WIP
2020-06-01 18:53:31 -04:00
Carlo Nucera
0e9438b6d3
Create new file-hash files
2020-06-01 17:32:40 -04:00
Carlo Nucera
0cb67ecbd3
Merge branch 'derivation-header-include-order' of github.com:Ericson2314/nix into validPathInfo-ca-proper-datatype
2020-06-01 17:13:11 -04:00
Carlo Nucera
f4b89e11a4
Merge branch 'no-stringly-typed-derivation-output' of github.com:Ericson2314/nix into validPathInfo-ca-proper-datatype
2020-06-01 17:12:50 -04:00
Tobias Pflug
eca1ff7a9f
Add tests for lru-cache.hh
2020-05-31 01:05:05 +02:00
Nikola Knezevic
fb38459d6e
Ensure we restrict refspec interpretation while fetching
...
As `git fetch` may chose to interpret refspec to it's liking, ensure that we
only pass refs that begin with `refs/` as is, otherwise, prepend them with
`refs/heads`. Otherwise, branches named `heads/foo` (I know it's bad, but it's
allowed), would be fetched as `foo`, instead of `heads/foo`.
2020-05-30 12:33:38 +02:00
Nikola Knezevic
77007d4eab
Improve ref validity checking in fetchGit
...
The previous regex was too strict and did not match what git was allowing. It
could lead to `fetchGit` not accepting valid branch names, even though they
exist in a repository (for example, branch names containing `/`, which are
pretty standard, like `release/1.0` branches).
The new regex defines what a branch name should **NOT** contain. It takes the
definitions from `refs.c` in https://github.com/git/git and `git help
check-ref-format` pages.
This change also introduces a test for ref name validity checking, which
compares the result from Nix with the result of `git check-ref-format --branch`.
2020-05-30 12:29:35 +02:00
John Ericson
fac0c2d54a
Remove addToStore variant as requested by FIXME
...
The idea is it's always more flexible to consumer a `Source` than a
plain string, and it might even reduce memory consumption.
I also looked at `addToStoreFromDump` with its `// FIXME: remove?`, but
the worked needed for that is far more up for interpretation, so I
punted for now.
2020-05-29 17:02:32 -04:00
Ben Burdette
734283d636
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-05-29 09:51:37 -06:00
Carlo Nucera
6dd471ebf6
Fixing the result of merge
2020-05-28 12:14:36 -04:00
Carlo Nucera
4f597fb901
Merge branch 'master' of github.com:NixOS/nix into enum-class
2020-05-28 10:58:22 -04:00
John Ericson
5b4cd84bc2
Merge remote-tracking branch 'me/more-rust-ffi' into no-stringly-typed-derivation-output
2020-05-28 10:35:53 -04:00
John Ericson
ef71caba29
Merge remote-tracking branch 'upstream/master' into more-rust-ffi
2020-05-28 10:31:46 -04:00
Eelco Dolstra
f60ce4fa20
Merge pull request #3631 from andir/libutil-config-tests
...
Add unit tests for config.cc
2020-05-28 13:51:37 +02:00
Eelco Dolstra
de141fcb79
Merge pull request #3455 from Ericson2314/enum-FileIngestionMethod
...
Replace some `bool recursive` with a new `FileIngestionMethod` enum
2020-05-28 13:50:06 +02:00
John Ericson
0f96f45061
Use FileIngestionMethod
for nix hash
...
There was an enum there that matched in perfectly.
2020-05-27 23:50:11 -04:00
Matthew Bauer
c66441a646
Rename some variables named “recursive” to “method”
...
This is much less confusing since recursive is no longer a boolean.
2020-05-27 13:21:26 -05:00
Matthew Bauer
7873fd175d
Don’t use FileIngestionMethod for StorePathsCommand
...
This is a different recursive than used in makeFixedOutputPath.
2020-05-27 13:21:11 -05:00
Andreas Rammhold
fc137d2f00
config.hh: Add documentation
...
Provides some general overview on the mechanics of Config/Setting and
comments for the public methods of Config.
2020-05-27 17:47:18 +02:00
Andreas Rammhold
9df3d8ccd7
tests/config.cc: add tests for Config::applyConfig
2020-05-27 17:47:18 +02:00
Andreas Rammhold
e1b8c64c04
config.cc: extract parts of applyConfigFile into applyConfig
...
This moves the actual parsing of configuration contents into applyConfig
which applyConfigFile is then going to call. By changing this we can now
test the configuration file parsing without actually create a file on
disk.
2020-05-27 17:47:18 +02:00
Andreas Rammhold
93129cf1dd
Add unit tests for config.cc
2020-05-27 17:47:17 +02:00
Eelco Dolstra
66d3ac94c9
Merge pull request #3621 from gilligan/add-json-tests
...
Add unit tests for "json.hh"
2020-05-27 11:08:12 +02:00
Eelco Dolstra
dae6a267a8
Merge pull request #3625 from gilligan/xml-writer-tests
...
Add unit tests for xml-writer
2020-05-27 11:07:53 +02:00
Carlo Nucera
f3f520c14c
Change syntax for CI
2020-05-26 12:51:28 -04:00
Carlo Nucera
89a5ac9d3b
Merge remote-tracking branch 'john-ericson/more-rust-ffi' into no-stringly-typed-derivation-output
2020-05-26 12:31:26 -04:00
Carlo Nucera
d49e65ba9d
Merge remote-tracking branch 'john-ericson/enum-FileIngestionMethod' into no-stringly-typed-derivation-output
2020-05-26 12:30:48 -04:00
Carlo Nucera
0f3f901071
Merge remote-tracking branch 'origin/master' into more-rust-ffi
2020-05-26 11:46:42 -04:00
Carlo Nucera
c2f33edd1f
Update src/libutil/rust-ffi.hh
...
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2020-05-26 11:43:18 -04:00
Carlo Nucera
b90241ceb1
Change remaining bools with FileIngestionMethod
2020-05-26 11:32:41 -04:00
Carlo Nucera
6d73c10041
Merge remote-tracking branch 'origin/master' into enum-FileIngestionMethod
2020-05-26 11:14:08 -04:00
Tobias Pflug
4b388e8431
Add unit tests for xml-writer
2020-05-25 18:34:55 +02:00
Tobias Pflug
c284700867
Add unit tests for "json.hh"
2020-05-25 11:57:45 +02:00
Tobias Pflug
ecc5c90dfc
Add unit tests for hashing functions
2020-05-25 11:50:41 +02:00
Ben Burdette
b7057fa627
remove error-demo from make; clean up comment
2020-05-21 16:04:18 -06:00
Ben Burdette
0e49de6a2b
position for stdin, string; (string) for trace; fix tests
2020-05-21 14:28:45 -06:00
Ben Burdette
6a420d672c
print LOC for stdin, string args
2020-05-20 22:18:26 -06:00
Ben Burdette
85ce455b85
get code lines from the nix file
2020-05-20 17:25:02 -06:00
Tobias Pflug
a73a820a5d
Add unit testes for url.cc
...
This adds tests for
- parseURL
- percentDecode
- decodeQuery
2020-05-20 16:37:35 +02:00
Eelco Dolstra
5ef64f05e6
Cleanup
2020-05-18 15:50:29 +02:00
Eelco Dolstra
0ed946aa61
Merge branch 'wait-for-builders' of https://github.com/serokell/nix
2020-05-18 13:48:45 +02:00
Ben Burdette
92123c6c79
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-05-15 07:00:36 -06:00
Ben Burdette
19694aa213
fix compile errors
2020-05-14 12:28:18 -06:00
Ben Burdette
4daccb279c
formatting
2020-05-14 10:28:17 -06:00
Alexander Bantyev
183dd28266
Don't lock a user while doing remote builds
2020-05-14 17:00:54 +03:00
Ben Burdette
ef9dd9f9bc
formatting and a few minor changes
2020-05-13 15:56:39 -06:00
Ben Burdette
c79d4addab
consistent capitalization
2020-05-13 10:02:18 -06:00
Ben Burdette
bfca5fc395
change status messages to info level
2020-05-13 09:52:36 -06:00
Ben Burdette
ecbb8e9c0a
no blank line if no LOC
2020-05-12 14:41:30 -06:00
Ben Burdette
960d4362ed
hint only
2020-05-12 13:54:18 -06:00
Ben Burdette
72ecccee57
convert to logWarning format
2020-05-12 12:19:34 -06:00
Ben Burdette
19cffc29c9
remove unused extra json fields
2020-05-12 12:09:12 -06:00
Ben Burdette
2a19bf8619
move pos to the first arg, to indicate its not used in a fmt template
2020-05-12 11:27:37 -06:00
Ben Burdette
ec870b9c85
new pos format for more errors
2020-05-12 10:52:26 -06:00
Eelco Dolstra
ebc024df22
Show hint how to enable experimental features
2020-05-12 15:47:09 +02:00
Eelco Dolstra
268ecf5b3f
nix: Don't require --experimental-features=nix-command for some subcommands
2020-05-12 15:47:09 +02:00
Ben Burdette
7c3138844c
more pos reporting
2020-05-11 17:34:57 -06:00
Ben Burdette
631642c5b4
new format for pos
2020-05-11 16:58:08 -06:00
Ben Burdette
b93c1bf3d6
fixes to merged code
2020-05-11 15:52:15 -06:00
Ben Burdette
59b1f5c701
Merge branch 'master' into errors-phase-2
2020-05-11 14:35:30 -06:00
Ben Burdette
536bbf53e1
comments and cleanup
2020-05-11 13:58:38 -06:00
Ben Burdette
958e81987b
switch from printError warnings to logWarnings
2020-05-11 13:02:16 -06:00
Domen Kožar
5bdb67c843
Merge pull request #3568 from kolloch/outputHashModeError
...
libstore/build.cc: more explicit error about form of output
2020-05-11 18:14:32 +02:00
Domen Kožar
1d8144e36b
Update src/libstore/build.cc
2020-05-11 18:14:23 +02:00
Benjamin Hipple
146f9c114f
doc: consistently refer to 'fixed-output' with a dash
...
General cleanup that makes it easier to search for the term.
2020-05-09 10:58:43 -04:00
Ben Burdette
55eb717148
add pos to errorinfo, remove from hints
2020-05-08 18:18:28 -06:00
Eelco Dolstra
d3d8186c9c
Merge pull request #3571 from gilligan/nix-unit-testing
...
Add unit tests
2020-05-08 17:02:25 +02:00
Tobias Pflug
181a47d884
Enable toLower umlauts test
...
Update comment and enable the test
2020-05-08 15:13:55 +02:00
Tobias Pflug
2191141274
Enable baseNameOf
test
...
Add note about removal of trailing slashes in the doc comment of
baseNameOf and enabled the test.
2020-05-08 15:07:40 +02:00
Tobias Pflug
e3df9c2a6e
Enable dirOf
test
...
Adjusted the doc comment for `dirOf` to reflect the implementation
behavior.
2020-05-08 15:03:44 +02:00
Eelco Dolstra
5b8883faac
configure: Look for gtest
2020-05-08 12:09:37 +02:00
Eelco Dolstra
ca657525b8
Don't install unit tests
2020-05-08 12:03:27 +02:00
Eelco Dolstra
7898cdb75a
make check: Run unit tests
2020-05-08 11:49:40 +02:00
Eelco Dolstra
72b9d971bc
Fix warning
2020-05-08 11:35:57 +02:00
Eelco Dolstra
7cc7cef950
Move unit tests to sr/libutil/tests, use mk make rules
2020-05-08 11:34:09 +02:00
Alexander Bantyev
772e5db828
Mention build users in the 'waiting for' message
2020-05-08 12:29:00 +03:00
Alexander Bantyev
14073fb76b
Don't block while waiting for build users
2020-05-08 12:22:39 +03:00
Ben Burdette
1b801cec40
pretending to be const
2020-05-07 16:43:36 -06:00
Tobias Pflug
1f3602a2c9
Remove replaceInSet
...
The function isn't being used anywhere so it seems safe to remove
2020-05-07 18:15:13 +02:00
Ben Burdette
e3901638b5
todo removal
2020-05-06 15:01:13 -06:00
Ben Burdette
e76ad2e48a
implement SysError errno handling
2020-05-06 14:07:20 -06:00
Domen Kožar
672985531c
Merge pull request #3570 from Mic92/nix-search
...
nix/search: no error for empty search results if json is enabled
2020-05-06 16:14:58 +02:00
Jörg Thalheim
85c1932c94
nix/search: no error for empty search results if json is enabled
...
- result list will be always empty if --json is passed
- for scripts an empty search result is not really an error,
we rather want to distinguish between evaluation errors and empty results
2020-05-06 14:43:54 +01:00
Eelco Dolstra
74a1bfdcab
Merge pull request #3546 from guibou/nix_readfile_on_0_sized_files
...
builtins.readFile: do not truncate content
2020-05-06 11:33:55 +02:00
Eelco Dolstra
272c4ba36d
Merge pull request #3557 from Ma27/nix-repl-help
...
Improve help-message for nix-repl
2020-05-06 11:25:47 +02:00
Peter Kolloch
9be46859a9
libstore/build.cc: more explicit about form of output
...
Be more explicit about why we expect a regular file as output
when outputHashMode=flat for a fixed output derivation.
2020-05-06 11:21:12 +02:00
Eelco Dolstra
02c5914ea4
Merge pull request #3562 from pikajude/master
...
Use fragment size for autoGC capacity calculation
2020-05-06 11:19:30 +02:00
Eelco Dolstra
fd4911269f
Revert "Merge pull request #3558 from LnL7/ssh-ng-stderr"
...
This reverts commit 3ebfbecdd1
, reversing
changes made to c089c52d5f
.
https://github.com/NixOS/nix/pull/3558
2020-05-06 10:54:18 +02:00
Eelco Dolstra
909b4a8820
nix doctor: Consistency
2020-05-05 15:27:47 +02:00
Eelco Dolstra
f132d82a79
nix --help: Group commands
2020-05-05 15:18:23 +02:00
Alexander Bantyev
04967dee9d
Wait for build users when none are available
2020-05-05 13:04:36 +03:00
Ben Burdette
7ffb5efdbc
appending to hints; remove _printError
2020-05-04 16:19:57 -06:00
Ben Burdette
f30de61578
add normaltxt, yellowify->yellowtxt
2020-05-04 16:19:20 -06:00
Jude Taylor
e2fc575c61
nix auto-gc: use fragment size
2020-05-04 14:42:06 -07:00
Ben Burdette
8c8f2b74ec
log as warning
2020-05-04 14:44:42 -06:00
Ben Burdette
afaa541013
affinity operator<<
2020-05-04 14:44:00 -06:00
Eelco Dolstra
a721a0b114
Flag: Use designated initializers
2020-05-04 22:40:19 +02:00
Ben Burdette
9c5ece44a7
separate msgs instead of appending to what()
2020-05-04 13:46:15 -06:00
Eelco Dolstra
3ebfbecdd1
Merge pull request #3558 from LnL7/ssh-ng-stderr
...
remote-store: don't log raw stderr by default
2020-05-04 13:02:33 +02:00
Ben Burdette
ab6f0b9641
convert some printError calls to logError
2020-05-03 08:01:25 -06:00
Daiderd Jordan
4769eea5e2
logging: handle build log lines in simple logger
...
The raw stderr output isn't logged anymore so the build logs need to be
printed by the default logger in order for the old commands like
nix-build to still show build output.
2020-05-02 23:40:53 +02:00
Daiderd Jordan
f16e24f95e
remote-store: don't log raw stderr by default
...
For remote stores the log messages are already forwarded as structured
STDERR_RESULT messages so the old format is duplicate information. But
still included with -vvv since it could be useful for debugging
problems.
$ nix build -L /nix/store/nl71b2niws857ffiaggyrkjwgx9jjzc0-foo.drv --store ssh-ng://localhost
Hello World!
foo> Hello World!
[1/0/1 built] building foo
Fixes #3556
2020-05-02 23:40:50 +02:00
Maximilian Bosch
2aeb874e83
Improve help-message for nix-repl
...
* Remove obsolete `printHelp` function
* Add an example to demonstrate how to list all available commands
within the REPL
2020-05-01 23:32:01 +02:00
Ben Burdette
4b99c09f5c
convert some errors
2020-05-01 14:32:06 -06:00
Eelco Dolstra
c089c52d5f
Fix build
2020-05-01 12:42:39 +02:00
Matthew Kenigsberg
d6b4047c2f
rename nix run to nix shell and nix app to nix run
...
(cherry picked from commit 5d8504b978
)
2020-05-01 12:17:36 +02:00
Ben Burdette
a3030e3c31
fix error calls
2020-04-30 17:56:26 -06:00
Ben Burdette
f5d3215c87
logError
2020-04-30 16:31:47 -06:00
Ben Burdette
171b4ce85c
typo
2020-04-30 09:57:01 -06:00
Eelco Dolstra
0135fd6ec4
nix dev-shell: Unset shellHook
...
This avoids inheriting the caller's shellHook, which can happen when
running a dev-shell inside a dev-shell.
2020-04-30 14:47:56 +02:00
Eelco Dolstra
efe6c186ea
nix dev-shell: Support structured attrs
...
Tested against https://github.com/NixOS/nixpkgs/pull/72074 .
Fixes #3540 .
2020-04-30 14:47:47 +02:00
Eelco Dolstra
2fcfc6c2c6
nix dev-shell: Refactor script for getting the environment
2020-04-30 13:05:29 +02:00
Domen Kožar
df8e9d691c
Merge pull request #3548 from Ma27/fetchtarball-pos
...
Fix displaying error-position in `builtins.fetch{Tree,Tarball}`
2020-04-30 10:33:12 +02:00
Ben Burdette
39ff80d031
errorinfo constructor test
2020-04-29 18:57:05 -06:00
Maximilian Bosch
d1229859c2
Fix displaying error-position in builtins.fetch{Tree,Tarball}
...
Without dereferencing this pointer, you'd get an error like this:
```
error: unsupported argument 'abc' to 'fetchTarball', at 0x13627e8
```
2020-04-29 22:53:39 +02:00
Guillaume Bouchard
2e5be2a749
StringSink pre allocate
...
When used with `readFile`, we have a pretty good heuristic of the file
size, so `reserve` this in the `string`. This will save some allocation
/ copy when the string is growing.
2020-04-29 18:44:01 +02:00
Guillaume Bouchard
7afcb5af98
Remove the drain
argument from readFile
...
Now it is always `drain` (see previous commit).
2020-04-29 18:43:45 +02:00
Ben Burdette
e2f61263eb
uncrustify formatting
2020-04-29 10:14:32 -06:00
Antoine Eiche
ca93b26db6
Only call grantpt on MacOS systems
...
The commit 3cc1125595
adds a `grantpt`
call on the builder pseudo terminal fd. This call is actually only
required for MacOS, but it however requires a RW access to /dev/pts
which is only RO bindmounted in the Bazel Linux sandbox. So, Nix can
not be actually run in the Bazel Linux sandbox for unneeded reasons.
2020-04-29 15:43:20 +02:00
Guillaume Bouchard
5a34a473dd
builtins.readFile: do not truncate content
...
This closes #3026 by allowing `builtins.readFile` to read a file with a
wrongly reported file size, for example, files in `/proc` may report a
file size of 0. Reading file in `/proc` is not a good enough motivation,
however I do think it just makes nix more robust by allowing more file
to be read. Especially, I do considerer the previous behavior to be
dangerous because nix was previously reading truncated files. Examples
of file system which incorrectly report file size may be network file
system or dynamic file system (for performance reason, a dynamic file
system such as FUSE may generate the content of the file on demand).
```
nix-repl> builtins.readFile "/proc/version"
""
```
With this commit:
```
nix-repl> builtins.readFile "/proc/version"
"Linux version 5.6.7 (nixbld@localhost) (gcc version 9.3.0 (GCC)) #1-NixOS SMP Thu Apr 23 08:38:27 UTC 2020\n"
```
Here is a summary of the behavior changes:
- If the reported size is smaller, previous implementation
was silently returning a truncated file content. The new implementation
is returning the correct file content.
- If a file had a bigger reported file size, previous implementation was
failing with an exception, but the new implementation is returning the
correct file content. This change of behavior is coherent with this pull
request.
Open questions
- The behavior is unchanged for correctly reported file size, however
performances may vary because it uses the more complex sink interface.
Considering that sink is used a lot, I don't think this impacts the
performance a lot.
- `builtins.readFile` on an infinite file, such as `/dev/random` may
fill the memory.
- it does not support adding file to store, such as `${/proc/version}`.
2020-04-29 14:50:52 +02:00
Ben Burdette
22e6490311
Error classname as name
2020-04-28 21:06:08 -06:00
Eelco Dolstra
06849c3090
Merge pull request #3542 from mkenigs/gcroots
...
Set GCROOT to store path to prevent garbage collection
2020-04-28 21:04:06 +02:00
Matthew Kenigsberg
6d40fe573c
rename to NIX_GCROOT
2020-04-28 11:18:54 -06:00
Eelco Dolstra
52a3ca823d
Tweak warning message
2020-04-28 17:56:01 +02:00
Eelco Dolstra
6a8cba83bb
Merge branch 'nix-env-warn-unmatched' of https://github.com/lheckemann/nix
2020-04-28 17:45:25 +02:00