about summary refs log tree commit diff
path: root/src/libutil/util.cc
AgeCommit message (Collapse)AuthorFilesLines
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);
2014-02-27 Set up a minimal /dev in chrootsEelco Dolstra1-0/+7
Not bind-mounting the /dev from the host also solves the problem with /dev/shm being a symlink to something not in the chroot.
2014-02-26 Remove another unused functionEelco Dolstra1-19/+0
2014-02-26 Remove unused functionEelco Dolstra1-28/+0
2013-11-14 Remove nix-setuid-helperEelco Dolstra1-13/+0
AFAIK, nobody uses it, it's not maintained, and it has no tests.
2013-08-26 Fix typos, especially those that end up in the Nix manualIvan Kozik1-2/+2
2013-08-19 Store Nix integers as longsEelco Dolstra1-8/+0
So on 64-bit systems, integers are now 64-bit. Fixes #158.
2013-07-30 killUser: Don't let the child kill itself on AppleShea Levy1-0/+13
The kill(2) in Apple's libc follows POSIX semantics, which means that kill(-1, SIGKILL) will kill the calling process too. Since nix has no way to distinguish between the process successfully killing everything and the process being killed by a rogue builder in that case, it can't safely conclude that killUser was successful. Luckily, the actual kill syscall takes a parameter that determines whether POSIX semantics are followed, so we can call that syscall directly and avoid the issue on Apple. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-12 Garbage collector: Don't follow symlinks arbitrarilyEelco Dolstra1-0/+9
Only indirect roots (symlinks to symlinks to the Nix store) are now supported.
2013-06-20 Don't keep "disabled" substituters runningEelco Dolstra1-0/+1
For instance, it's pointless to keep copy-from-other-stores running if there are no other stores, or download-using-manifests if there are no manifests. This also speeds things up because we don't send queries to those substituters.
2013-01-03 Remove tabsEelco Dolstra1-44/+44
2013-01-03 Clear any immutable bits in the Nix storeEelco Dolstra1-3/+0
Doing this once makes subsequent operations like garbage collecting more efficient since we don't have to call makeMutable() first.
2012-11-26 Make "nix-build -A <derivation>.<output>" do the right thingEelco Dolstra1-1/+13
For example, given a derivation with outputs "out", "man" and "bin": $ nix-build -A pkg produces ./result pointing to the "out" output; $ nix-build -A pkg.man produces ./result-man pointing to the "man" output; $ nix-build -A pkg.all produces ./result, ./result-man and ./result-bin; $ nix-build -A pkg.all -A pkg2 produces ./result, ./result-man, ./result-bin and ./result-2.
2012-11-15 Don't use std::cerr in a few placesEelco Dolstra1-15/+20
Slightly scared of using std::cerr in a vforked process...
2012-11-15 Add some debug codeEelco Dolstra1-1/+1
2012-11-09 Use vfork() instead of fork() if availableEelco Dolstra1-3/+11
Hopefully this reduces the chance of hitting ‘unable to fork: Cannot allocate memory’ errors. vfork() is used for everything except starting builders.
2012-11-09 Remove some redundant close() callsEelco Dolstra1-10/+8
They are unnecessary because we set the close-on-exec flag.
2012-11-09 Remove the quickExit functionEelco Dolstra1-9/+3
2012-09-28 Handle octal escapes in /proc/self/mountinfoEelco Dolstra1-0/+15
2012-09-19 Templatise tokenizeString()Eelco Dolstra1-2/+5
2012-08-27 Merge branch 'master' into no-manifestsEelco Dolstra1-15/+10
2012-08-20 In the chroot, make all mounted filesystems privateEelco Dolstra1-2/+2
This is required on systemd, which mounts filesystems as "shared" subtrees. Changes to shared trees in a private mount namespace are propagated to the outside world, which is bad.
2012-08-01 Drop the block count in the garbage collectorEelco Dolstra1-13/+8
2012-08-01 DohEelco Dolstra1-1/+1
2012-08-01 Report substituter errors to clients of the Nix daemonEelco Dolstra1-1/+8
2012-07-26 Set permissions on temporary build directories to 0700Eelco Dolstra1-2/+2
Fixes #39.
2012-06-25 When using chroots, use a private PID namespaceEelco Dolstra1-2/+5
In a private PID namespace, processes have PIDs that are separate from the rest of the system. The initial child gets PID 1. Processes in the chroot cannot see processes outside of the chroot. This improves isolation between builds. However, processes on the outside can see processes in the chroot and send signals to them (if they have appropriate rights). Since the builder gets PID 1, it serves as the reaper for zombies in the chroot. This might turn out to be a problem. In that case we'll need to have a small PID 1 process that sits in a loop calling wait().
2012-03-05 Set the close-on-exec flag on file descriptorsEelco Dolstra1-0/+12
2012-02-15 On Linux, make the Nix store really read-only by using the immutable bitEelco Dolstra1-0/+3
I was bitten one time too many by Python modifying the Nix store by creating *.pyc files when run as root. On Linux, we can prevent this by setting the immutable bit on files and directories (as in ‘chattr +i’). This isn't supported by all filesystems, so it's not an error if setting the bit fails. The immutable bit is cleared by the garbage collector before deleting a path. The only tricky aspect is in optimiseStore(), since it's forbidden to create hard links to an immutable file. Thus optimiseStore() temporarily clears the immutable bit before creating the link.
2012-02-09 Use data() instead of c_str() where appropriateEelco Dolstra1-3/+3
2011-12-22 * In the garbage collector, delete invalid paths before deletingEelco Dolstra1-1/+9
unreachable paths. This matters when using --max-freed etc.: unreachable paths could become reachable again, so it's nicer to keep them if there is "real" garbage to be deleted. Also, don't use readDirectory() but read the Nix store and delete invalid paths in parallel. This reduces GC latency on very large Nix stores.
2010-12-13 * nix-instantiate: return exit status 100 to denote a permanent buildEelco Dolstra1-1/+2
failure. The build hook can use this to distinguish between transient and permanent failures on the remote side.
2010-12-13 * createDirs(path): if path already exists, make sure it's aEelco Dolstra1-20/+22
directory. * Provide a C++ wrapper around lstat().
2010-10-04 * Sync with the trunk.Eelco Dolstra1-1/+10
2010-10-04 * In printMsg(), ignore failing writes to stderr if we're in anEelco Dolstra1-1/+10
exception handler, otherwise throw an exception. We need to ignore write errors in exception handlers to ensure that cleanup code runs to completion if the other side of stderr has been closed unexpectedly.
2010-08-27 * Experimental feature: allow a derivation to tell the build hook thatEelco Dolstra1-0/+11
it requires a certain feature on the build machine, e.g. requiredSystemFeatures = [ "kvm" ]; We need this in Hydra to make sure that builds that require KVM support are forwarded to machines that have KVM support. Probably this should also be enforced for local builds.
2010-08-04 * Sync with the trunk.Eelco Dolstra1-0/+1
2010-06-24 src/libutil/util.cc: include <limit.h> to ensure that PATH_MAX is definedPeter Simons1-0/+1