aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
AgeCommit message (Collapse)Author
2016-04-25Improved logging abstractionEelco Dolstra
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-20Cache path info lookups in SQLiteEelco Dolstra
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-29Improve SIGINT handling in multi-threaded programsEelco Dolstra
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-29Add "nix verify-paths" commandEelco Dolstra
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-28Fix reading symlinksEelco Dolstra
The st_size field of a symlink doesn't have to be correct, e.g. for /dev/fd symlinks.
2016-02-24deletePath(): Succeed if path doesn't existEelco Dolstra
Also makes it robust against concurrent deletions.
2016-01-27TriviaEelco Dolstra
2016-01-05Fix compilationEelco Dolstra
2016-01-05Merge pull request #685 from vizanto/masterEelco Dolstra
POSIX compliant directory access (fixes build on Solaris)
2015-11-25Use DT_UNKNOWN when dirent d_type extension is not supported.Danny Wilson
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-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-07Fix build on SolarisDanny Wilson
d_type is not part of the POSIX spec unfortunately.
2015-10-29int2String() -> std::to_string()Eelco Dolstra
2015-10-21revert libutil changeJude Taylor
2015-10-21make sandbox builds more permissiveJude Taylor
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-17OCD: foreach -> C++11 ranged forEelco Dolstra
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-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-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-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-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-03Remove some duplicate codeEelco Dolstra
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
2014-08-20nix-store -l: Automatically pipe output into $PAGEREelco Dolstra
2014-08-04Get rid of "killing <pid>" message for unused build hooksEelco Dolstra
2014-08-01Call commonChildInit() before doing chroot initEelco Dolstra
This ensures that daemon clients see error messages from the chroot setup.
2014-08-01Eliminate redundant copyEelco Dolstra
2014-08-01Make readDirectory() return inode / file typeEelco Dolstra
2014-07-31Restore default SIGPIPE handler before invoking ‘man’Eelco Dolstra
Fixes NixOS/nixpkgs#3410.
2014-07-23nix-daemon: Simplify stderr handlingEelco Dolstra
2014-07-23startProcess: Make writing error messages from the child more robustEelco Dolstra