about summary refs log tree commit diff
path: root/src/libutil
AgeCommit message (Collapse)AuthorFilesLines
2016-02-11 ref<T>: Add cast operatorEelco Dolstra1-13/+6
2016-02-04 Eliminate the "store" global variableEelco Dolstra2-0/+77
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2016-01-27 Define HashType's size to allow it to be forward-declaredEelco Dolstra1-1/+1
2016-01-27 TriviaEelco Dolstra1-1/+2
2016-01-27 Make hashLength32() a method of HashEelco Dolstra2-12/+15
2016-01-20 string2Int: Barf on negative numbers for unsigned typesEelco Dolstra1-1/+3
2016-01-05 Fix compilationEelco Dolstra1-1/+7
2016-01-05 Merge pull request #685 from vizanto/masterEelco Dolstra2-1/+7
POSIX compliant directory access (fixes build on Solaris)
2016-01-05 Fixed unresolved 'BUFSIZ'FrankHB1-0/+1
`BUFSIZ` is defined in header `<cstdio>`.
2015-12-10 Build sandbox support etc. unconditionally on LinuxEelco Dolstra1-5/+5
Also, use "#if __APPLE__" instead of "#if SANDBOX_ENABLED" to prevent ambiguity.
2015-11-25 Use DT_UNKNOWN when dirent d_type extension is not supported.Danny Wilson1-5/+1
edolstra: “…since callers of readDirectory have to handle the possibility of DT_UNKNOWN anyway, and we don't want to do a stat call for every directory entry unless it's really needed.”
2015-11-16 Default arguments belong at declaration, not definitionShea Levy1-1/+1
2015-11-16 Fix copy-paste errorShea Levy1-1/+1
2015-11-16 AutoDelete: Add default constructor with deletion disabledShea Levy2-0/+10
2015-11-09 Fix namespace issueEelco Dolstra1-2/+2
2015-11-07 Fix build on SolarisDanny Wilson2-0/+10
d_type is not part of the POSIX spec unfortunately.
2015-11-04 Support SHA-512 hashesEelco Dolstra2-2/+10
Fixes #679. Note: on x86_64, SHA-512 is considerably faster than SHA-256 (198 MB/s versus 131 MB/s).
2015-11-04 Require OpenSSLEelco Dolstra9-1752/+1
2015-10-30 <nix/fetchurl.nix>: Support xz-compressed NARsEelco Dolstra3-1/+58
2015-10-29 int2String() -> std::to_string()Eelco Dolstra3-9/+2
2015-10-21 revert libutil changeJude Taylor1-5/+4
2015-10-21 make sandbox builds more permissiveJude Taylor1-4/+5
2015-10-01 nix-prefetch-url: Rewrite in C++Eelco Dolstra1-0/+1
2015-09-18 Shut up clang warningsEelco Dolstra1-1/+0
2015-09-03 Implement buildDerivation() via the daemonEelco Dolstra2-0/+8
2015-08-07 baseNameOf: Enhance `basename` compatibilityKirill Elagin1-3/+12
* If the path ends with a slash, drop it. * If the remaining path doesn’t contain slashes, just return it. Fixes #574.
2015-07-20 Support systemd log severity prefixesEelco Dolstra2-1/+14
This is mostly useful for hydra-queue-runner.
2015-07-20 More cleanupEelco Dolstra3-97/+54
2015-07-17 OCD: foreach -> C++11 ranged forEelco Dolstra4-17/+10
2015-07-17 Allow remote builds without sending the derivation closureEelco Dolstra2-1/+39
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-17 Support URLs in $NIX_PATHEelco Dolstra2-0/+19
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-09 Use std::vector::data()Eelco Dolstra2-7/+6
2015-05-13 cygwin: looks like stdout/stdin are reserved wordsRok Garbas1-10/+10
2015-04-09 Implement caching of fetchurl/fetchTarball resultsEelco Dolstra2-0/+27
ETags are used to prevent redownloading unchanged files.
2015-02-10 Add base64 encoder/decoderEelco Dolstra2-0/+64
2015-02-04 Use libsodium instead of OpenSSL for binary cache signingEelco Dolstra2-7/+20
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-03 Simplify parseHash32Eelco Dolstra1-37/+10
2015-02-03 Simplify printHash32Eelco Dolstra1-35/+17
2015-01-02 libutil: Limit readLink() error to only overflows.aszlig1-2/+2
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-02 libutil: Improve errmsg on readLink size mismatch.aszlig1-1/+5
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-14 PedantryEelco Dolstra1-1/+1
2014-12-14 Merge branch 'cygwin-master' of https://github.com/ternaris/nixEelco Dolstra1-0/+1
2014-12-12 Fix some memory leaksEelco Dolstra2-6/+18
2014-12-12 Ensure we're writing to stderr in the builderEelco Dolstra2-12/+14
http://hydra.nixos.org/build/17862041
2014-12-12 DohEelco Dolstra1-2/+2
2014-12-10 Don't do vfork in conjunction with setuidEelco Dolstra1-0/+3
2014-12-10 Use vforkEelco Dolstra2-10/+33
2014-12-10 Revert "Use posix_spawn to run the pager"Eelco Dolstra2-9/+2
This reverts commit d34d2b2bbf784c0bb420a50905af25e02c6e4989.
2014-12-09 Explicitly include required C headersMarko Durkovic1-0/+1
2014-12-05 Use posix_spawn to run the pagerEelco Dolstra2-2/+9
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...)