about summary refs log tree commit diff
path: root/src/libutil/util.cc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-11-26 Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra1-28/+28
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25 Get rid of unicode quotes (#1140)Guillaume Maudoux1-28/+28
2016-10-12 Add some functions needed by hydraEelco Dolstra1-0/+8
2016-10-06 Merge pull request #998 from veprbl/rx_chmod_fixEelco Dolstra1-4/+5
override rx directory permissions in deletePath()
2016-09-21 nix-build, nix-shell: Don't print error message if nix-store/nix-instantiate ↵Eelco Dolstra1-1/+1
fails
2016-09-21 printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra1-5/+5
2016-09-21 Some notational convenience for formatting stringsEelco Dolstra1-10/+3
We can now write throw Error("file '%s' not found", path); instead of throw Error(format("file '%s' not found") % path); and similarly printError("file '%s' not found", path); instead of printMsg(lvlError, format("file '%s' not found") % path);
2016-09-20 TweakEelco Dolstra1-2/+2
2016-09-20 nix-shell: Fix $PATH handling in the impure caseEelco Dolstra1-0/+15
We were passing "p=$PATH" rather than "p=$PATH;", resulting in some invalid shell code. Also, construct a separate environment for the child rather than overwriting the parent's.
2016-09-16 Make computeFSClosure() single-threaded againEelco Dolstra1-0/+11
The fact that queryPathInfo() is synchronous meant that we needed a thread for every concurrent binary cache lookup, even though they end up being handled by the same download thread. Requiring hundreds of threads is not a good idea. So now there is an asynchronous version of queryPathInfo() that takes a callback function to process the result. Similarly, enqueueDownload() now takes a callback rather than returning a future. Thus, a command like nix path-info --store https://cache.nixos.org/ -r /nix/store/slljrzwmpygy1daay14kjszsr9xix063-nixos-16.09beta231.dccf8c5 that returns 4941 paths now takes 1.87s using only 2 threads (the main thread and the downloader thread). (This is with a prewarmed CloudFront.)
2016-09-16 printMsg(): Don't check for interruptsEelco Dolstra1-8/+8
Having the logger function potentially throw exceptions is Heisenbuggy.
2016-09-14 Add a toLower utility functionEelco Dolstra1-0/+10
2016-09-14 Move some .drv parsing functions out of utilEelco Dolstra1-41/+0
2016-07-25 override rx directory permissions in deletePath()Dmitry Kalinkin1-4/+5
This fixes instantiation of pythonPackages.pytest that produces a directory with less permissions during one of it's tests that leads to a nix error like: error: opening directory ‘/tmp/nix-build-python2.7-pytest-2.9.2.drv-0/pytest-of-user/pytest-0/testdir/test_cache_failure_warns0/.cache’: Permission denied
2016-07-11 Modernize AutoCloseFDShea Levy1-38/+25
2016-06-09 Use O_CLOEXEC in most placesEelco Dolstra1-4/+8
2016-06-02 createTempDir(): Don't do a chown on LinuxEelco Dolstra1-0/+2
It's not needed and can cause problems in a user namespace.
2016-04-29 Support Git repos in the Nix pathEelco Dolstra1-0/+6
E.g. $ nix-build -I nixpkgs=git://github.com/NixOS/nixpkgs '<nixpkgs>' -A hello This is not extremely useful yet because you can't specify a branch/revision.
2016-04-25 Improved logging abstractionEelco Dolstra1-110/+3
This also gets rid of --log-type, since the nested log type isn't useful in a multi-threaded situation, and nobody cares about the "pretty" log type.
2016-04-20 Cache path info lookups in SQLiteEelco Dolstra1-0/+12
This re-implements the binary cache database in C++, allowing it to be used by other Store backends, in particular the S3 backend.
2016-03-29 Improve SIGINT handling in multi-threaded programsEelco Dolstra1-2/+4
The flag remembering whether an Interrupted exception was thrown is now thread-local. Thus, all threads will (eventually) throw Interrupted. Previously, one thread would throw Interrupted, and then the other threads wouldn't see that they were supposed to quit.
2016-03-29 Add "nix verify-paths" commandEelco Dolstra1-1/+1
Unlike "nix-store --verify-path", this command verifies signatures in addition to store path contents, is multi-threaded (especially useful when verifying binary caches), and has a progress indicator. Example use: $ nix verify-paths --store https://cache.nixos.org -r $(type -p thunderbird) ... [17/132 checked] checking ‘/nix/store/rawakphadqrqxr6zri2rmnxh03gqkrl3-autogen-5.18.6’
2016-02-28 Fix reading symlinksEelco Dolstra1-1/+1
The st_size field of a symlink doesn't have to be correct, e.g. for /dev/fd symlinks.
2016-02-24 deletePath(): Succeed if path doesn't existEelco Dolstra1-4/+8
Also makes it robust against concurrent deletions.
2016-01-27 TriviaEelco Dolstra1-1/+2
2016-01-05 Fix compilationEelco Dolstra1-1/+7
2016-01-05 Merge pull request #685 from vizanto/masterEelco Dolstra1-1/+1
POSIX compliant directory access (fixes build on Solaris)
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 Levy1-0/+8
2015-11-07 Fix build on SolarisDanny Wilson1-0/+4
d_type is not part of the POSIX spec unfortunately.
2015-10-29 int2String() -> std::to_string()Eelco Dolstra1-1/+1
2015-10-21 revert libutil changeJude Taylor1-5/+4
2015-10-21 make sandbox builds more permissiveJude Taylor1-4/+5
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 Dolstra1-0/+12
This is mostly useful for hydra-queue-runner.
2015-07-17 OCD: foreach -> C++11 ranged forEelco Dolstra1-4/+4
2015-06-17 Support URLs in $NIX_PATHEelco Dolstra1-0/+14
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 Dolstra1-6/+5
2015-05-13 cygwin: looks like stdout/stdin are reserved wordsRok Garbas1-10/+10
2015-04-09 Implement caching of fetchurl/fetchTarball resultsEelco Dolstra1-0/+20
ETags are used to prevent redownloading unchanged files.
2015-02-10 Add base64 encoder/decoderEelco Dolstra1-0/+59
2015-02-04 Use libsodium instead of OpenSSL for binary cache signingEelco Dolstra1-6/+19
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-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-12 Fix some memory leaksEelco Dolstra1-6/+13
2014-12-12 Ensure we're writing to stderr in the builderEelco Dolstra1-12/+13
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