aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
AgeCommit message (Collapse)Author
2018-06-12Remove duplicate definition of allocBytes()Eelco Dolstra
2018-05-30Fix static assertion failure on 32-bit systemsEelco Dolstra
2018-05-30Move evaluator-specific settings out of libstoreEelco Dolstra
2018-05-28Merge pull request #2187 from bgamari/stoi-exceptionsEelco Dolstra
json-to-value: Use strtol instead of strtoi
2018-05-26json-to-value: Use strtol instead of strtoiBen Gamari
NixInt is long, so strtoi is too restrictive.
2018-05-26eval.cc: add message to static_assert, message can be omitted w/c++17Will Dietz
2018-05-24Merge pull request #2157 from volth/bitwiseEelco Dolstra
add builtins: __bitAnd, __bitOr, __bitXor
2018-05-22Make Env self-describingEelco Dolstra
If the Env denotes a 'with', then values[0] may be an Expr* cast to a Value*. For code that generically traverses Values/Envs, it's useful to know this.
2018-05-22Memoise checkSourcePath()Eelco Dolstra
This prevents hydra-eval-jobs from statting the same files over and over again.
2018-05-16add `mod' and bitwise builtins: camel-case function namesvolth
2018-05-16add `mod' and bitwise builtins: remove `mod' and shiftsvolth
2018-05-16add `mod' and bitwise builtins: remove infix functionsvolth
2018-05-12add `mod' and bitwise builtinsvolth
2018-05-11Don't return negative numbers from the flex tokenizerEelco Dolstra
Fixes #1374. Closes #2129.
2018-05-11Revert "Throw a specific error for incomplete parse errors."Eelco Dolstra
This reverts commit 6498adb002bcf7e715afe46c23b8635d4592c156. We don't actually use IncompleteParseError in 'nix repl'.
2018-05-09In restricted eval mode, allow access to the closure of store pathsEelco Dolstra
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-02Fix some random -Wconversion warningsEelco Dolstra
2018-04-23Merge branch 'pos-crash-fix' of git://github.com/dezgeg/nixShea Levy
2018-04-18parser: Allow mixed nested and top-level attrpathsFélix Baylac-Jacqué
Fixes #2077.
2018-04-17isFunction: True on primops.Shea Levy
Fixes #2073
2018-04-09Export required C++ version in pkgconfig.Shea Levy
2018-04-09Make prim_exec and prim_importNative available to pluginsShea Levy
2018-04-03libexpr: Make unsafeGetAttrPos not crash on noPosTuomas Tynkkynen
Currently e.g. `builtins.unsafeGetAttrPos "abort" builtins` will eventually segfault because pos->file is an unset Symbol. Found by afl-fuzz.
2018-03-19Shut up signedness warningEelco Dolstra
2018-03-16Merge pull request #1939 from dezgeg/lexer-fixEelco Dolstra
libexpr: Recognize newline in more places in lexer
2018-03-14Catch more possible instances of passing NULL to memcpy.Shea Levy
Actually fixes #1976.
2018-03-14concatLists: Don't pass NULL pointers to memcpy.Shea Levy
This is UB, even if the size is 0. See #1976. Fixes #1976.
2018-03-14Fix compatibility with latest boost::formatEelco Dolstra
2018-03-13fetchGit: Fix debug messageGuillaume Maudoux
2018-03-09Modified MakeBinOp to no longer produce its name using concatenation and "##".Tim Engler
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-02libexpr: Recognize newline in more places in lexerTuomas Tynkkynen
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-28fetchGit: use "HEAD" as default refWill Dietz
2018-02-28Actually fix nixDataDir in non-canonical pathShea Levy
2018-02-26libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen
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-22Merge branch 'data-dir-non-canon' of https://github.com/shlevy/nixEelco Dolstra
2018-02-22Fix restricted mode when installing in non-canonical data dirShea Levy
2018-02-21Revert "libexpr: Fix prim_replaceStrings() to work on an empty source string"Eelco Dolstra
This reverts commit 4ea9707591beceacf9988b3c185faf50da238403. It causes an infinite loop in Nixpkgs evaluation, e.g. "nix-instantiate -A hello" hung. PR #1886.
2018-02-19libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen
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-19libexpr: Don't create lots of temporary strings in Bindings::lexicographicOrderTuomas Tynkkynen
Avoids ~180,000 string temporaries created when evaluating a headless NixOS system.
2018-02-17libexpr: Avoid an unnecessary string copy in prim_derivationStrictTuomas Tynkkynen
2018-02-17libexpr: Remove unnecessary drvName assignment in prim_derivationStrictTuomas Tynkkynen
drvName is already assigned to the same value right at the start of the function.
2018-02-17libexpr: Optimize prim_derivationStrict by using more symbol comparisonsTuomas Tynkkynen
2018-02-17libexpr: Rely on Boehm returning zeroed memory in EvalState::allocEnv()Tuomas Tynkkynen
Boehm guarantees that memory returned by GC_malloc() is zeroed, so take advantage of that.
2018-02-17libexpr: Optimize prim_attrNames a bitTuomas Tynkkynen
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-16libexpr: Pre-reserve space in string in unescapeStr()Tuomas Tynkkynen
Avoids some malloc() traffic.
2018-02-14Add splitVersion primop.Shea Levy
Fixes #1868.
2018-02-13Merge branch 'register-constant' of https://github.com/shlevy/nixEelco Dolstra
2018-02-11Nix stats: flatten statisticsFrederik Rietdijk
Flattens the list of statistics as suggested in https://github.com/NixOS/ofborg/issues/67. This makes it easier to work with.
2018-02-08Allow using RegisterPrimop to define constants.Shea Levy
This enables plugins to add new constants, as well as new primops.
2018-02-07Merge pull request #1816 from shlevy/add-pathEelco Dolstra
Add path primop.