aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
AgeCommit message (Collapse)Author
2019-07-02Merge pull request #2582 from LnL7/fetchgit-refsEelco Dolstra
fetchGit: allow fetching explicit refs
2019-06-24Fix 32-bit overflow with --no-netEelco Dolstra
--no-net causes tarballTtl to be set to the largest 32-bit integer, which causes comparison like 'time + tarballTtl < other_time' to fail on 32-bit systems. So cast them to 64-bit first. https://hydra.nixos.org/build/95076624 (cherry picked from commit 29ccb2e9697ee2184012dd13854e487928ae4441)
2019-06-24Refactor downloadCached() interfaceEelco Dolstra
(cherry picked from commit df3f5a78d5ab0a1f2dc9d288b271b38a9b8b33b5)
2019-06-24CachedDownloadResult: Include store pathEelco Dolstra
Also, make fetchGit and fetchMercurial update allowedPaths properly. (Maybe the evaluator, rather than the caller of the evaluator, should apply toRealPath(), but that's a bigger change.) (cherry picked from commit 5c34d665386f4053d666b0899ecca0639e500fbd)
2019-06-24downloadCached: Return ETagEelco Dolstra
(cherry picked from commit 529add316c5356a8060c35f987643b7bf5c796dc)
2019-06-24Fix abort in fromTOMLEelco Dolstra
Fixes #2969.
2019-05-28Iterate over referencesEelco Dolstra
2019-05-28Merge branch 'attrPaths' of https://github.com/NinjaTrappeur/nixEelco Dolstra
2019-05-03Add builtins.hashFileDaniel Schaefer
For text files it is possible to do it like so: `builtins.hashString "sha256" (builtins.readFile /tmp/a)` but that doesn't work for binary files. With builtins.hashFile any kind of file can be conveniently hashed.
2019-04-11Add environment variable NIX_SHOW_SYMBOLS for dumping the symbol tableEelco Dolstra
2019-03-27Fix Bison 3.3 warningEelco Dolstra
2019-03-24Add isPath primopzimbatm
this is added for completeness' sake since all the other possible `builtins.typeOf` results have a corresponding `builtins.is<Type>`
2019-03-21eval: improve type description for primops and applied primopsLinus Heckemann
This can make type errors a little easier to understand.
2019-03-14pkg-config files: Use c++17Eelco Dolstra
2019-03-14experimental/optional -> optionalEelco Dolstra
2019-01-31Add builtins.appendContext.Shea Levy
A partner of builtins.getContext, useful for the same reasons.
2019-01-14Add builtins.getContext.Shea Levy
This can be very helpful when debugging, as well as enabling complex black magic like surgically removing a single dependency from a string's context.
2019-01-13Treat plain derivation paths in context as normal paths.Shea Levy
Previously, plain derivation paths in the string context (e.g. those that arose from builtins.storePath on a drv file, not those that arose from accessing .drvPath of a derivation) were treated somewhat like derivaiton paths derived from .drvPath, except their dependencies weren't recursively added to the input set. With this change, such plain derivation paths are simply treated as paths and added to the source inputs set accordingly, simplifying context handling code and removing the inconsistency. If drvPath-like behavior is desired, the .drv file can be imported and then .drvPath can be accessed. This is a backwards-incompatibility, but storePath is never used on drv files within nixpkgs and almost never used elsewhere.
2019-01-10Merge pull request #2608 from dtzWill/fix/issue-2546Eelco Dolstra
EvalState::resetFileCache: clear parse cache as well as eval cache
2019-01-05Remove mentions of `libformat`, it no longer existsJohn Ericson
2018-12-31EvalState::resetFileCache: clear parse cache as well as eval cacheWill Dietz
Fixes #2546. (at least the basic reproduction I've been testing)
2018-12-14fetchGit: allow fetching explicit refsDaiderd Jordan
Trying to fetch refs that are not in refs/heads currently fails because it looks for refs/heads/refs/foo instead of refs/foo. eg. builtins.fetchGit { url = https://github.com/NixOS/nixpkgs.git; ref = "refs/pull/1024/head; }
2018-12-13Support SRI hashesEelco Dolstra
SRI hashes (https://www.w3.org/TR/SRI/) combine the hash algorithm and a base-64 hash. This allows more concise and standard hash specifications. For example, instead of import <nix/fetchurl.nl> { url = https://nixos.org/releases/nix/nix-2.1.3/nix-2.1.3.tar.xz; sha256 = "5d22dad058d5c800d65a115f919da22938c50dd6ba98c5e3a183172d149840a4"; }; you can write import <nix/fetchurl.nl> { url = https://nixos.org/releases/nix/nix-2.1.3/nix-2.1.3.tar.xz; hash = "sha256-XSLa0FjVyADWWhFfkZ2iKTjFDda6mMXjoYMXLRSYQKQ="; }; In fixed-output derivations, the outputHashAlgo is no longer mandatory if outputHash specifies the hash (either as an SRI or in the old "<type>:<hash>" format). 'nix hash-{file,path}' now print hashes in SRI format by default. I also reverted them to use SHA-256 by default because that's what we're using most of the time in Nixpkgs. Suggested by @zimbatm.
2018-12-06Solve hg "abandoned transaction" issueCHEIKH Chawki
2018-11-20fetchGit: Drop unnecessary localRefEelco Dolstra
2018-11-20Merge branch 'better-git-cache' of https://github.com/graham-at-target/nixEelco Dolstra
2018-10-31Fix typo in commentsJan Path
2018-10-27simplify handling of extra '}'Guillaume Maudoux
2018-09-13Merge branch 'dirOf-relative' of https://github.com/lheckemann/nixEelco Dolstra
2018-09-05Convert NIX_COUNT_CALLS to JSON tooEelco Dolstra
2018-09-05Log stats to stderrEelco Dolstra
We shouldn't pollute stdout.
2018-09-02remove the old text format outputMichael Bishop
2018-09-01add JSON to NIX_SHOW_STATSMichael Bishop
2018-09-01improve the stats when profilingMichael Bishop
2018-09-01fetchGit/fetchMercurial: Don't absolutize pathsEelco Dolstra
This is already done by coerceToString(), provided that the argument is a path (e.g. 'fetchGit ./bla'). It fixes the handling of URLs like git@github.com:owner/repo.git. It breaks 'fetchGit "./bla"', but that was never intended to work anyway and is inconsistent with other builtin functions (e.g. 'readFile "./bla"' fails).
2018-08-29libexpr: Use int64_t for NixIntaszlig
Using a 64bit integer on 32bit systems will come with a bit of a performance overhead, but given that Nix doesn't use a lot of integers compared to other types, I think the overhead is negligible also considering that 32bit systems are in decline. The biggest advantage however is that when we use a consistent integer size across all platforms it's less likely that we miss things that we break due to that. One example would be: https://github.com/NixOS/nixpkgs/pull/44233 On Hydra it will evaluate, because the evaluator runs on a 64bit machine, but when evaluating the same on a 32bit machine it will fail, so using 64bit integers should make that consistent. While the change of the type in value.hh is rather easy to do, we have a few more options available for doing the conversion in the lexer: * Via an #ifdef on the architecture and using strtol() or strtoll() accordingly depending on which architecture we are. For the #ifdef we would need another AX_COMPILE_CHECK_SIZEOF in configure.ac. * Using istringstream, which would involve copying the value. * As we're already using boost, lexical_cast might be a good idea. Spoiler: I went for the latter, first of all because lexical_cast does have an overload for const char* and second of all, because it doesn't involve copying around the input string. Also, because istringstream seems to come with a bigger overhead than boost::lexical_cast: https://www.boost.org/doc/libs/release/doc/html/boost_lexical_cast/performance.html The first method (still using strtol/strtoll) also wasn't something I pursued further, because it is also locale-aware which I doubt is what we want, given that the regex for int is [0-9]+. Signed-off-by: aszlig <aszlig@nix.build> Fixes: #2339
2018-08-23Revert "Fix parser/lexer generation with parallel make"Eelco Dolstra
This reverts commit d277442df53a01343ba7c1df0bbd2a294058dcba. Make sucks.
2018-08-19FIx floating point evaluationEelco Dolstra
Fixes #2361.
2018-08-17fetchGit: use a better caching schemeGraham Christensen
The current usage technically works by putting multiple different repos in to the same git directory. However, it is very slow as Git tries very hard to find common commits between the two repositories. If the two repositories are large (like Nixpkgs and another long-running project,) it is maddeningly slow. This change busts the cache for existing deployments, but users will be promptly repaid in per-repository performance.
2018-08-17Fix parser/lexer generation with parallel makeEelco Dolstra
Fun fact: rules with multiple targets don't work properly with 'make -j'. For example, a rule like a b: c touch a b is equivalent to a: c touch a b b: c touch a b so with 'make -j', the 'touch' command will be run twice. See e.g. https://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file.
2018-08-13dirOf: allow use on non-absolute pathsLinus Heckemann
2018-08-03Merge pull request #2326 from aszlig/fix-symlink-leakEelco Dolstra
Fix symlink leak in restricted eval mode
2018-08-03Fix symlink leak in restricted eval modeaszlig
In EvalState::checkSourcePath, the path is checked against the list of allowed paths first and later it's checked again *after* resolving symlinks. The resolving of the symlinks is done via canonPath, which also strips out "../" and "./". However after the canonicalisation the error message pointing out that the path is not allowed prints the symlink target in the error message. Even if we'd suppress the message, symlink targets could still be leaked if the symlink target doesn't exist (in this case the error is thrown in canonPath). So instead, we now do canonPath() without symlink resolving first before even checking against the list of allowed paths and then later do the symlink resolving and checking the allowed paths again. The first call to canonPath() should get rid of all the "../" and "./", so in theory the only way to leak a symlink if the attacker is able to put a symlink in one of the paths allowed by restricted evaluation mode. For the latter I don't think this is part of the threat model, because if the attacker can write to that path, the attack vector is even larger. Signed-off-by: aszlig <aszlig@nix.build>
2018-07-31Merge branch 'prim_mapAttr-fix' of https://github.com/volth/nixEelco Dolstra
2018-07-23Merge pull request #2303 from volth/patch-4Eelco Dolstra
parser.y: fix assoc of -> and < > <= >=
2018-07-23parser.y: right-associativity of ->volth
2018-07-21parser.y: fix assoc of -> and < > <= >=volth
The parser allowed senseless `a > b > c` but disallowed `a -> b -> c` which seems valid It might be a typo
2018-07-21prim_foldlStrict: call forceValue() before value is copiedvolth
forceValue() were called after a value is copied effectively forcing only one of the copies keeping another copy not evaluated. This resulted in its evaluation of the same lazy value more than once (the number of hits is not big though)
2018-07-11Fix build on 32-bit systems and macOSEelco Dolstra
Apparently, on macOS, 'long' != 'int64_t'. https://hydra.nixos.org/build/77100756
2018-07-11Shup up a warningEelco Dolstra