about summary refs log tree commit diff
path: root/src/libutil/util.hh
AgeCommit message (Collapse)AuthorFilesLines
2014-03-28 Don't interpret strings as format stringsEelco Dolstra1-3/+3
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/+3
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-3/+0
2014-02-26 Remove unused functionEelco Dolstra1-4/+0
2013-11-14 Remove nix-setuid-helperEelco Dolstra1-4/+0
AFAIK, nobody uses it, it's not maintained, and it has no tests.
2013-08-19 Store Nix integers as longsEelco Dolstra1-1/+6
So on 64-bit systems, integers are now 64-bit. Fixes #158.
2013-07-12 Garbage collector: Don't follow symlinks arbitrarilyEelco Dolstra1-0/+4
Only indirect roots (symlinks to symlinks to the Nix store) are now supported.
2013-01-03 Remove tabsEelco Dolstra1-2/+2
2012-11-26 Make "nix-build -A <derivation>.<output>" do the right thingEelco Dolstra1-0/+1
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-1/+3
Slightly scared of using std::cerr in a vforked process...
2012-11-09 Use vfork() instead of fork() if availableEelco Dolstra1-0/+3
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 the quickExit functionEelco Dolstra1-4/+0
2012-09-28 Handle octal escapes in /proc/self/mountinfoEelco Dolstra1-0/+6
2012-09-19 Templatise tokenizeString()Eelco Dolstra1-1/+1
2012-08-27 Merge branch 'master' into no-manifestsEelco Dolstra1-3/+5
2012-08-20 In the chroot, make all mounted filesystems privateEelco Dolstra1-1/+1
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-12 Add some basic profiling support to the evaluatorEelco Dolstra1-0/+3
Setting the environment variable NIX_COUNT_CALLS to 1 enables some basic profiling in the evaluator. It will count calls to functions and primops as well as evaluations of attributes. For example, to see where evaluation of a NixOS configuration spends its time: $ NIX_SHOW_STATS=1 NIX_COUNT_CALLS=1 ./src/nix-instantiate/nix-instantiate '<nixos>' -A system --readonly-mode ... calls to 39 primops: 239532 head 233962 tail 191252 hasAttr ... calls to 1595 functions: 224157 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:19' 221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:14' 221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:10' ... evaluations of 7088 attributes: 167377 undefined position 132459 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:119:41' 47322 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:13:21' ...
2012-08-01 Drop the block count in the garbage collectorEelco Dolstra1-2/+1
2012-08-01 Report substituter errors to clients of the Nix daemonEelco Dolstra1-0/+4
2012-07-26 Set permissions on temporary build directories to 0700Eelco Dolstra1-1/+1
Fixes #39.
2012-07-18 Use "#pragma once" to prevent repeated header file inclusionEelco Dolstra1-5/+1
2012-03-05 Set the close-on-exec flag on file descriptorsEelco Dolstra1-0/+3
2011-12-22 * In the garbage collector, delete invalid paths before deletingEelco Dolstra1-0/+1
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 * createDirs(path): if path already exists, make sure it's aEelco Dolstra1-0/+4
directory. * Provide a C++ wrapper around lstat().
2010-08-27 * Experimental feature: allow a derivation to tell the build hook thatEelco Dolstra1-0/+5
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-05-12 * Sync with the trunk.Eelco Dolstra1-29/+13
2010-04-19 * Don't use the ATerm library for parsing/printing .drv files.Eelco Dolstra1-23/+12
2010-04-12 * Remove some obsolete functions.Eelco Dolstra1-5/+0
2010-03-23 (no commit message)Eelco Dolstra1-1/+1
2010-03-04 * Synced with the trunk.Eelco Dolstra1-2/+0
2010-02-24 * Don't use fdatasync since it doesn't work on Snow Leopard.Eelco Dolstra1-6/+0
* Don't refer to config.h in util.hh, because config.h is not installed (http://hydra.nixos.org/build/303053).
2010-02-24 * Remove the fdatasync check since it's no longer needed.Eelco Dolstra1-5/+1
2010-02-02 * If fdatasync() isn't available, use fsync().Eelco Dolstra1-0/+4
2010-01-29 * Added an option "fsync-metadata" to fsync() changes toEelco Dolstra1-5/+1
/nix/var/nix/db. * Removed the function writeStringToFile since it does (almost) the same thing as writeFile.
2009-12-17 * Include config.h before the C library headers, because it definesEelco Dolstra1-0/+2
_FILE_OFFSET_BITS=64. Without it, functions like stat() fail on large file sizes. This happened with a Nix store on squashfs: $ nix-store --dump /tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds > /dev/null error: getting attributes of path `/tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds': Value too large for defined data type $ stat /tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds File: `/tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds' Size: 0 Blocks: 36028797018963968 IO Block: 1024 regular empty file (This is a bug in squashfs or mksquashfs, but it shouldn't cause Nix to fail.)
2009-11-24 * Grrr.Eelco Dolstra1-1/+1
2009-11-24 * GCC 4.4 is stricter about the EOF macroEelco Dolstra1-0/+2
(http://hydra.nixos.org/build/156340).
2009-11-24 * Templatise getIntArg / string2Int.Eelco Dolstra1-2/+7
2009-03-28 * Simplify communication with the hook a bit (don't use fileEelco Dolstra1-0/+6
descriptors 3/4, just use stdin/stderr).
2008-09-17 * Garbage collector: added an option `--use-atime' to delete paths inEelco Dolstra1-0/+23
order of ascending last access time. This is useful in conjunction with --max-freed or --max-links to prefer deleting non-recently used garbage, which is good (especially in the build farm) since garbage may become live again. The code could easily be modified to accept other criteria for ordering garbage by changing the comparison operator used by the priority queue in collectGarbage().
2008-08-25 * Strip off the `.nix' suffix from the attribute name for files inEelco Dolstra1-0/+4
~/.nix-defexpr, otherwise the attribute cannot be selected with the `-A' option. Useful if you want to stick a Nix expression directly in ~/.nix-defexpr.
2008-08-02 * Make nix-env --dry-run print the paths to be substituted correctlyEelco Dolstra1-0/+4
again. (After the previous substituter mechanism refactoring I didn't update the code that obtains the references of substitutable paths.) This required some refactoring: the substituter programs are now kept running and receive/respond to info requests via stdin/stdout.
2008-06-18 * --max-freed: support values >= 4 GB.Eelco Dolstra1-0/+1
2008-06-18 * Some refactoring: put the GC options / results in separate structs.Eelco Dolstra1-3/+5
* The garbage collector now also prints the number of blocks freed.
2008-06-09 * Merged the no-bdb branch (-r10900:HEADEelco Dolstra1-0/+4
https://svn.nixos.org/repos/nix/nix/branches/no-bdb).
2008-03-27 * Use /tmp/nix-build-<drvpath>-<counter> instead ofEelco Dolstra1-1/+2
/tmp/nix-<pid>-<counter> for temporary build directories. This increases purity a bit: many packages store the temporary build path in their output, causing (generally unimportant) binary differences.
2007-10-27 * Delete the chroot directory automatically.Eelco Dolstra1-1/+1
* Removed some debug messages.
2007-10-27 * Support for doing builds in a chroot under Linux. The builder isEelco Dolstra1-3/+5
executed in a chroot that contains just the Nix store, the temporary build directory, and a configurable set of additional directories (/dev and /proc by default). This allows a bit more purity enforcement: hidden build-time dependencies on directories such as /usr or /nix/var/nix/profiles are no longer possible. As an added benefit, accidental network downloads (cf. NIXPKGS-52) are prevented as well (because files such as /etc/resolv.conf are not available in the chroot). However the usefulness of chroots is diminished by the fact that many builders depend on /bin/sh, so you need /bin in the list of additional directories. (And then on non-NixOS you need /lib as well...)
2007-08-12 * Get rid of the substitutes database table (NIX-47). Instead, if weEelco Dolstra1-1/+1
need any info on substitutable paths, we just call the substituters (such as download-using-manifests.pl) directly. This means that it's no longer necessary for nix-pull to register substitutes or for nix-channel to clear them, which makes those operations much faster (NIX-95). Also, we don't have to worry about keeping nix-pull manifests (in /nix/var/nix/manifests) and the database in sync with each other. The downside is that there is some overhead in calling an external program to get the substitutes info. For instance, "nix-env -qas" takes a bit longer. Abolishing the substitutes table also makes the logic in local-store.cc simpler, as we don't need to store info for invalid paths. On the downside, you cannot do things like "nix-store -qR" on a substitutable but invalid path (but nobody did that anyway). * Never catch interrupts (the Interrupted exception).
2007-05-01 * Set a terminate() handler to ensure that we leave the BDBEelco Dolstra1-0/+5
environment cleanly even when an exception is thrown from a destructor. We still crash, but we don't take all other Nix processes with us.