about summary refs log tree commit diff
path: root/src/libutil/util.cc
AgeCommit message (Collapse)AuthorFilesLines
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
2014-12-10 Use vforkEelco Dolstra1-8/+23
2014-12-10 Revert "Use posix_spawn to run the pager"Eelco Dolstra1-8/+2
This reverts commit d34d2b2bbf784c0bb420a50905af25e02c6e4989.
2014-12-05 Use posix_spawn to run the pagerEelco Dolstra1-2/+8
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-19 nix-daemon: Call exit(), not _exit()Eelco Dolstra1-2/+5
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-03 Remove some duplicate codeEelco Dolstra1-0/+10
2014-10-03 createDirs(): Handle ‘path’ being a symlinkEelco Dolstra1-0/+3
In particular, this fixes "nix-build -o /tmp/result" on Mac OS X (where /tmp is a symlink).
2014-09-19 Remove bogus commentEelco Dolstra1-1/+0
2014-08-21 Use PR_SET_PDEATHSIG to ensure child cleanupEelco Dolstra1-1/+10
2014-08-20 Use proper quotes everywhereEelco Dolstra1-26/+26
2014-08-20 Add some colorEelco Dolstra1-0/+35
2014-08-20 nix-store -l: Automatically pipe output into $PAGEREelco Dolstra1-2/+2
2014-08-04 Get rid of "killing <pid>" message for unused build hooksEelco Dolstra1-2/+3
2014-08-01 Call commonChildInit() before doing chroot initEelco Dolstra1-8/+10
This ensures that daemon clients see error messages from the chroot setup.
2014-08-01 Eliminate redundant copyEelco Dolstra1-1/+1
2014-08-01 Make readDirectory() return inode / file typeEelco Dolstra1-8/+7
2014-07-31 Restore default SIGPIPE handler before invoking ‘man’Eelco Dolstra1-0/+10
Fixes NixOS/nixpkgs#3410.
2014-07-23 nix-daemon: Simplify stderr handlingEelco Dolstra1-0/+1
2014-07-23 startProcess: Make writing error messages from the child more robustEelco Dolstra1-2/+4
2014-07-10 Fix broken Pid constructorEelco Dolstra1-5/+2
2014-07-10 Refactoring: Move all fork handling into a higher-order functionEelco Dolstra1-54/+53
C++11 lambdas ftw.
2014-07-10 Remove maybeVforkEelco Dolstra1-8/+1
2014-05-21 nix-store -l: Fetch build logs from the InternetEelco Dolstra1-1/+1
If a build log is not available locally, then ‘nix-store -l’ will now try to download it from the servers listed in the ‘log-servers’ option in nix.conf. For instance, if you have: log-servers = http://hydra.nixos.org/log then it will try to get logs from http://hydra.nixos.org/log/<base name of the store path>. So you can do things like: $ nix-store -l $(which xterm) and get a log even if xterm wasn't built locally.
2014-04-08 If a .drv cannot be parsed, show its pathEelco Dolstra1-1/+1
Otherwise you just get ‘expected string `Derive(['’ which isn't very helpful.
2014-03-28 Don't interpret strings as format stringsEelco Dolstra1-13/+13
Ludo reported this error: unexpected Nix daemon error: boost::too_few_args: format-string refered to more arguments than were passed coming from this line: printMsg(lvlError, run.program + ": " + string(err, 0, p)); The problem here is that the string ends up implicitly converted to a Boost format() object, so % characters are treated specially. I always assumed (wrongly) that strings are converted to a format object that outputs the string as-is. Since this assumption appears in several places that may be hard to grep for, I've added some C++ type hackery to ensures that the right thing happens. So you don't have to worry about % in statements like printMsg(lvlError, "foo: " + s); or throw Error("foo: " + s);