about summary refs log tree commit diff
path: root/src/libexpr (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-05-11 Don't return negative numbers from the flex tokenizerEelco Dolstra1-1/+5
Fixes #1374. Closes #2129.
2018-05-11 Revert "Throw a specific error for incomplete parse errors."Eelco Dolstra3-11/+1
This reverts commit 6498adb002bcf7e715afe46c23b8635d4592c156. We don't actually use IncompleteParseError in 'nix repl'.
2018-05-09 In restricted eval mode, allow access to the closure of store pathsEelco Dolstra1-1/+11
E.g. this makes nix eval --restrict-eval -I /nix/store/foo '(builtins.readFile "/nix/store/foo/symlink/bla")' (where /nix/store/foo/symlink is a symlink to another path in the closure of /nix/store/foo) succeed. This fixes a regression in Hydra compared to Nix 1.x (where there were no restrictions at all on access to the Nix store).
2018-05-02 Fix some random -Wconversion warningsEelco Dolstra7-57/+60
2018-04-23 Merge branch 'pos-crash-fix' of git://github.com/dezgeg/nixShea Levy1-1/+1
2018-04-17 isFunction: True on primops.Shea Levy1-1/+12
Fixes #2073
2018-04-09 Export required C++ version in pkgconfig.Shea Levy1-1/+1
2018-04-09 Make prim_exec and prim_importNative available to pluginsShea Levy2-2/+10
2018-04-03 libexpr: Make unsafeGetAttrPos not crash on noPosTuomas Tynkkynen1-1/+1
Currently e.g. `builtins.unsafeGetAttrPos "abort" builtins` will eventually segfault because pos->file is an unset Symbol. Found by afl-fuzz.
2018-03-19 Shut up signedness warningEelco Dolstra2-2/+2
2018-03-16 Merge pull request #1939 from dezgeg/lexer-fixEelco Dolstra1-4/+5
libexpr: Recognize newline in more places in lexer
2018-03-14 Catch more possible instances of passing NULL to memcpy.Shea Levy1-4/+8
Actually fixes #1976.
2018-03-14 concatLists: Don't pass NULL pointers to memcpy.Shea Levy1-1/+2
This is UB, even if the size is 0. See #1976. Fixes #1976.
2018-03-14 Fix compatibility with latest boost::formatEelco Dolstra2-23/+23
2018-03-13 fetchGit: Fix debug messageGuillaume Maudoux1-1/+1
2018-03-09 Modified MakeBinOp to no longer produce its name using concatenation and "##".Tim Engler1-11/+11
Doing so prevents emacs tags from working, as well as makes the code extremely confusing for a newbie. In the prior state, if someone wants to find the definition of "ExprApp" for example, a grep through the code reveals nothing. Since the definition could be hiding in numerous ".h" files, it's really difficult to find. This personally took me several hours to figure out.
2018-03-02 libexpr: Recognize newline in more places in lexerTuomas Tynkkynen1-4/+5
Flex's regexes have an annoying feature: the dot matches everything except a newline. This causes problems for expressions like: "${0}\ " where the backslash-newline combination matches this rule instead of the intended one mentioned in the comment: <STRING>\$|\\|\$\\ { /* This can only occur when we reach EOF, otherwise the above (...|\$[^\{\"\\]|\\.|\$\\.)+ would have triggered. This is technically invalid, but we leave the problem to the parser who fails with exact location. */ return STR; } However, the parser actually accepts the resulting token sequence ('"' DOLLAR_CURLY 0 '}' STR '"'), which is a problem because the lexer rule didn't assign anything to yylval. Ultimately this leads to a crash when dereferencing a NULL pointer in ExprConcatStrings::bindVars(). The fix does change the syntax of the language in some corner cases but I think it's only turning previously invalid (or crashing) syntax to valid syntax. E.g. "a\ b" and ''a''\ b'' were previously syntax errors but now both result in "a\nb". Found by afl-fuzz.
2018-02-28 fetchGit: use "HEAD" as default refWill Dietz1-1/+1
2018-02-28 Actually fix nixDataDir in non-canonical pathShea Levy2-2/+2
2018-02-26 libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen1-3/+14
Otherwise, running e.g. nix-instantiate --eval -E --strict 'builtins.replaceStrings [""] ["X"] "abc"' would just hang in an infinite loop. Found by afl-fuzz. First attempt of this was reverted in e2d71bd1862cdda because it caused another infinite loop, which is fixed now and a test added.
2018-02-22 Merge branch 'data-dir-non-canon' of https://github.com/shlevy/nixEelco Dolstra1-1/+1
2018-02-22 Fix restricted mode when installing in non-canonical data dirShea Levy1-1/+1
2018-02-21 Revert "libexpr: Fix prim_replaceStrings() to work on an empty source string"Eelco Dolstra1-8/+3
This reverts commit 4ea9707591beceacf9988b3c185faf50da238403. It causes an infinite loop in Nixpkgs evaluation, e.g. "nix-instantiate -A hello" hung. PR #1886.
2018-02-19 libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen1-3/+8
Otherwise, running e.g. nix-instantiate --eval -E --strict 'builtins.replaceStrings [""] ["X"] "abc"' would just hang in an infinite loop. Found by afl-fuzz.
2018-02-19 libexpr: Don't create lots of temporary strings in Bindings::lexicographicOrderTuomas Tynkkynen1-1/+1
Avoids ~180,000 string temporaries created when evaluating a headless NixOS system.
2018-02-17 libexpr: Avoid an unnecessary string copy in prim_derivationStrictTuomas Tynkkynen1-1/+1
2018-02-17 libexpr: Remove unnecessary drvName assignment in prim_derivationStrictTuomas Tynkkynen1-6/+0
drvName is already assigned to the same value right at the start of the function.
2018-02-17 libexpr: Optimize prim_derivationStrict by using more symbol comparisonsTuomas Tynkkynen3-10/+15
2018-02-17 libexpr: Rely on Boehm returning zeroed memory in EvalState::allocEnv()Tuomas Tynkkynen2-5/+5
Boehm guarantees that memory returned by GC_malloc() is zeroed, so take advantage of that.
2018-02-17 libexpr: Optimize prim_attrNames a bitTuomas Tynkkynen1-2/+5
Instead of having lexicographicOrder() create a temporary sorted array of Attr*:s and copying attr names from that, copy the attr names first and then sort that.
2018-02-16 libexpr: Pre-reserve space in string in unescapeStr()Tuomas Tynkkynen1-3/+4
Avoids some malloc() traffic.
2018-02-14 Add splitVersion primop.Shea Levy3-1/+24
Fixes #1868.
2018-02-13 Merge branch 'register-constant' of https://github.com/shlevy/nixEelco Dolstra3-2/+11
2018-02-11 Nix stats: flatten statisticsFrederik Rietdijk1-3/+6
Flattens the list of statistics as suggested in https://github.com/NixOS/ofborg/issues/67. This makes it easier to work with.
2018-02-08 Allow using RegisterPrimop to define constants.Shea Levy3-2/+11
This enables plugins to add new constants, as well as new primops.
2018-02-07 Merge pull request #1816 from shlevy/add-pathEelco Dolstra2-19/+76
Add path primop.
2018-02-06 Add path primop.Shea Levy2-19/+76
builtins.path allows specifying the name of a path (which makes paths with store-illegal names now addable), allows adding paths with flat instead of recursive hashes, allows specifying a filter (so is a generalization of filterSource), and allows specifying an expected hash (enabling safe path adding in pure mode).
2018-02-06 realiseContext(): Add derivation outputs to the allowed pathsEelco Dolstra1-10/+24
This makes import-from-derivation work in restricted mode again.
2018-02-06 checkURI(): Check file URIs against allowedPathsEelco Dolstra1-0/+12
This makes e.g. 'fetchGit ./.' work (assuming that ./. is an allowed path).
2018-01-19 Don't use [[noreturn]]Eelco Dolstra1-6/+3
2018-01-18 Don't define builtins.{currentSystem,currentTime} in pure modeEelco Dolstra1-6/+2
This makes it easier to provide a default, e.g. system = builtins.currentSystem or "x86_64-linux";
2018-01-17 TypoEelco Dolstra1-1/+1
2018-01-16 Add pure evaluation modeEelco Dolstra5-44/+94
In this mode, the following restrictions apply: * The builtins currentTime, currentSystem and storePath throw an error. * $NIX_PATH and -I are ignored. * fetchGit and fetchMercurial require a revision hash. * fetchurl and fetchTarball require a sha256 attribute. * No file system access is allowed outside of the paths returned by fetch{Git,Mercurial,url,Tarball}. Thus 'nix build -f ./foo.nix' is not allowed. Thus, the evaluation result is completely reproducible from the command line arguments. E.g. nix build --pure-eval '( let nix = fetchGit { url = https://github.com/NixOS/nixpkgs.git; rev = "9c927de4b179a6dd210dd88d34bda8af4b575680"; }; nixpkgs = fetchGit { url = https://github.com/NixOS/nixpkgs.git; ref = "release-17.09"; rev = "66b4de79e3841530e6d9c6baf98702aa1f7124e4"; }; in (import (nix + "/release.nix") { inherit nix nixpkgs; }).build.x86_64-linux )' The goal is to enable completely reproducible and traceable evaluation. For example, a NixOS configuration could be fully described by a single Git commit hash. 'nixos-rebuild' would do something like nix build --pure-eval '( (import (fetchGit { url = file:///my-nixos-config; rev = "..."; })).system ') where the Git repository /my-nixos-config would use further fetchGit calls or Git externals to fetch Nixpkgs and whatever other dependencies it has. Either way, the commit hash would uniquely identify the NixOS configuration and allow it to reproduced.
2018-01-12 import, builtins.readFile: Handle diverted storesEelco Dolstra3-6/+25
Fixes #1791
2018-01-09 fetchGit: fix creation of uninitialized cache dir, let git create itWill Dietz1-1/+0
fetchGit test (as modified in previous commit) now passes.
2018-01-02 Add hasContext primopShea Levy1-0/+9
2017-12-22 fetchGit: Fix handling of local repo when not using 'master' branchWill Dietz1-1/+5
Add tests checking this behavior.
2017-12-14 json-to-value: Throw sensible error message on invalid numbersBen Gamari1-4/+10
2017-12-05 Merge branch 'fetchGit-fast-revision-update'Shea Levy1-24/+35
2017-11-24 nix-shell/nix-build: Support .drv files againEelco Dolstra2-0/+29
Fixes #1663. Also handle '!<output-name>' (#1694).