aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
AgeCommit message (Collapse)Author
2015-11-16Default arguments belong at declaration, not definitionShea Levy
2015-11-16Fix copy-paste errorShea Levy
2015-11-16AutoDelete: Add default constructor with deletion disabledShea Levy
2015-11-09Fix namespace issueEelco Dolstra
2015-11-04Support SHA-512 hashesEelco Dolstra
Fixes #679. Note: on x86_64, SHA-512 is considerably faster than SHA-256 (198 MB/s versus 131 MB/s).
2015-11-04Require OpenSSLEelco Dolstra
2015-10-30<nix/fetchurl.nix>: Support xz-compressed NARsEelco Dolstra
2015-10-29int2String() -> std::to_string()Eelco Dolstra
2015-10-21revert libutil changeJude Taylor
2015-10-21make sandbox builds more permissiveJude Taylor
2015-10-01nix-prefetch-url: Rewrite in C++Eelco Dolstra
2015-09-18Shut up clang warningsEelco Dolstra
2015-09-03Implement buildDerivation() via the daemonEelco Dolstra
2015-08-07baseNameOf: Enhance `basename` compatibilityKirill Elagin
* If the path ends with a slash, drop it. * If the remaining path doesn’t contain slashes, just return it. Fixes #574.
2015-07-20Support systemd log severity prefixesEelco Dolstra
This is mostly useful for hydra-queue-runner.
2015-07-20More cleanupEelco Dolstra
2015-07-17OCD: foreach -> C++11 ranged forEelco Dolstra
2015-07-17Allow remote builds without sending the derivation closureEelco Dolstra
Previously, to build a derivation remotely, we had to copy the entire closure of the .drv file to the remote machine, even though we only need the top-level derivation. This is very wasteful: the closure can contain thousands of store paths, and in some Hydra use cases, include source paths that are very large (e.g. Git/Mercurial checkouts). So now there is a new operation, StoreAPI::buildDerivation(), that performs a build from an in-memory representation of a derivation (BasicDerivation) rather than from a on-disk .drv file. The only files that need to be in the Nix store are the sources of the derivation (drv.inputSrcs), and the needed output paths of the dependencies (as described by drv.inputDrvs). "nix-store --serve" exposes this interface. Note that this is a privileged operation, because you can construct a derivation that builds any store path whatsoever. Fixing this will require changing the hashing scheme (i.e., the output paths should be computed from the other fields in BasicDerivation, allowing them to be verified without access to other derivations). However, this would be quite nice because it would allow .drv-free building (e.g. "nix-env -i" wouldn't have to write any .drv files to disk). Fixes #173.
2015-06-17Support URLs in $NIX_PATHEelco Dolstra
This didn't work (despite claims in the manual), because the colon in "http://" was parsed as a element separator. So handle "://" specially.
2015-06-09Use std::vector::data()Eelco Dolstra
2015-05-13cygwin: looks like stdout/stdin are reserved wordsRok Garbas
2015-04-09Implement caching of fetchurl/fetchTarball resultsEelco Dolstra
ETags are used to prevent redownloading unchanged files.
2015-02-10Add base64 encoder/decoderEelco Dolstra
2015-02-04Use libsodium instead of OpenSSL for binary cache signingEelco Dolstra
Sodium's Ed25519 signatures are much shorter than OpenSSL's RSA signatures. Public keys are also much shorter, so they're now specified directly in the nix.conf option ‘binary-cache-public-keys’. The new command ‘nix-store --generate-binary-cache-key’ generates and prints a public and secret key.
2015-02-03Simplify parseHash32Eelco Dolstra
2015-02-03Simplify printHash32Eelco Dolstra
2015-01-02libutil: Limit readLink() error to only overflows.aszlig
Let's not just improve the error message itself, but also the behaviour to actually work around the ntfs-3g symlink bug. If the readlink() call returns a smaller size than the stat() call, this really isn't a problem even if the symlink target really has changed between the calls. So if stat() reports the size for the absolute path, it's most likely that the relative path is smaller and thus it should also work for file system bugs as mentioned in 93002d69fc58c2b71e2dfad202139230c630c53a. Signed-off-by: aszlig <aszlig@redmoonstudios.org> Tested-by: John Ericson <Ericson2314@Yahoo.com>
2015-01-02libutil: Improve errmsg on readLink size mismatch.aszlig
A message like "error: reading symbolic link `...' : Success" really is quite confusing, so let's not indicate "success" but rather point out the real issue. We could also limit the check of this to just check for non-negative values, but this would introduce a race condition between stat() and readlink() if the link target changes between those two calls, thus leading to a buffer overflow vulnerability. Reported by @Ericson2314 on IRC. Happened due to a possible ntfs-3g bug where a relative symlink returned the absolute path (st_)size in stat() while readlink() returned the relative size. Signed-off-by: aszlig <aszlig@redmoonstudios.org> Tested-by: John Ericson <Ericson2314@Yahoo.com>
2014-12-14PedantryEelco Dolstra
2014-12-14Merge branch 'cygwin-master' of https://github.com/ternaris/nixEelco Dolstra
2014-12-12Fix some memory leaksEelco Dolstra
2014-12-12Ensure we're writing to stderr in the builderEelco Dolstra
http://hydra.nixos.org/build/17862041
2014-12-12DohEelco Dolstra
2014-12-10Don't do vfork in conjunction with setuidEelco Dolstra
2014-12-10Use vforkEelco Dolstra
2014-12-10Revert "Use posix_spawn to run the pager"Eelco Dolstra
This reverts commit d34d2b2bbf784c0bb420a50905af25e02c6e4989.
2014-12-09Explicitly include required C headersMarko Durkovic
2014-12-05Use posix_spawn to run the pagerEelco Dolstra
In low memory environments, "nix-env -qa" failed because the fork to run the pager hit the kernel's overcommit limits. Using posix_spawn gets around this. (Actually, you have to use posix_spawn with the undocumented POSIX_SPAWN_USEVFORK flag, otherwise it just uses fork/exec...)
2014-11-25Add a primop for regular expression pattern matchingEelco Dolstra
The function ‘builtins.match’ takes a POSIX extended regular expression and an arbitrary string. It returns ‘null’ if the string does not match the regular expression. Otherwise, it returns a list containing substring matches corresponding to parenthesis groups in the regex. The regex must match the entire string (i.e. there is an implied "^<pat>$" around the regex). For example: match "foo" "foobar" => null match "foo" "foo" => [] match "f(o+)(.*)" "foooobar" => ["oooo" "bar"] match "(.*/)?([^/]*)" "/dir/file.nix" => ["/dir/" "file.nix"] match "(.*/)?([^/]*)" "file.nix" => [null "file.nix"] The following example finds all regular files with extension .nix or .patch underneath the current directory: let findFiles = pat: dir: concatLists (mapAttrsToList (name: type: if type == "directory" then findFiles pat (dir + "/" + name) else if type == "regular" && match pat name != null then [(dir + "/" + name)] else []) (readDir dir)); in findFiles ".*\\.(nix|patch)" (toString ./.)
2014-11-19nix-daemon: Call exit(), not _exit()Eelco Dolstra
This was preventing destructors from running. In particular, it was preventing the deletion of the temproot file for each worker process. It may also have been responsible for the excessive WAL growth on Hydra (due to the SQLite database not being closed properly). Apparently broken by accident in 8e9140cfdef9dbd1eb61e4c75c91d452ab5e4a74.
2014-10-20Fix build on gcc < 4.7Shea Levy
2014-10-20Revert "Drop support for pre-c++11 compilers."Shea Levy
The breakage this fixed can be worked around without removing support. This reverts commit 84a13dc576496f1227665259c61f86184f452f51.
2014-10-18Drop support for pre-c++11 compilers.Shea Levy
In particular, gcc 4.6's std::exception::~exception has an exception specification in c++0x mode, which requires us to use that deprecated feature in nix (and led to breakage after some recent changes that were valid c++11). nix already uses several c++11 features and gcc 4.7 has been around for over 2 years.
2014-10-03Remove some duplicate codeEelco Dolstra
2014-10-03nix-env: Add regular expression support in selectorsEelco Dolstra
So you can now do things like: $ nix-env -qa '.*zip.*' $ nix-env -qa '.*(firefox|chromium).*'
2014-10-03createDirs(): Handle ‘path’ being a symlinkEelco Dolstra
In particular, this fixes "nix-build -o /tmp/result" on Mac OS X (where /tmp is a symlink).
2014-09-19Remove bogus commentEelco Dolstra
2014-08-21Use PR_SET_PDEATHSIG to ensure child cleanupEelco Dolstra
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-08-20Add some colorEelco Dolstra