about summary refs log tree commit diff
path: root/src/libstore
AgeCommit message (Collapse)AuthorFilesLines
2012-06-27 nix-store -r: do substitutions in parallelEelco Dolstra6-12/+19
I.e. when multiple non-derivation arguments are passed to ‘nix-store -r’ to be substituted, do them in parallel.
2012-06-27 Mount an empty /dev/shm tmpfs in the chrootEelco Dolstra1-0/+6
This ensures that whatever the builder writes in /dev/shm is automatically cleaned up.
2012-06-27 Check the return code of the clone() callEelco Dolstra1-1/+2
2012-06-25 When using chroots, use a private PID namespaceEelco Dolstra1-154/+181
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-06-25 Use a private UTS namespace to provide a deterministic host/domain name to ↵Eelco Dolstra1-1/+7
builders In chroot builds, set the host name to "localhost" and the domain name to "(none)" (the latter being the kernel's default). This improves determinism a bit further. P.S. I have to idea what UTS stands for.
2012-06-23 Improve error messageEelco Dolstra1-1/+1
2012-06-23 In chroot builds, use a private SysV IPC namespaceEelco Dolstra1-12/+19
This improves isolation a bit further, and it's just one extra flag in the unshare() call. P.S. It would be very cool to use CLONE_NEWPID (to put the builder in a private PID namespace) as well, but that's slightly more risky since having a builder start as PID 1 may cause problems.
2012-06-23 In chroot builds, use a private network namespaceEelco Dolstra1-6/+31
On Linux it's possible to run a process in its own network namespace, meaning that it gets its own set of network interfaces, disjunct from the rest of the system. We use this to completely remove network access to chroot builds, except that they get a private loopback interface. This means that: - Builders cannot connect to the outside network or to other processes on the same machine, except processes within the same build. - Vice versa, other processes cannot connect to processes in a chroot build, and open ports/connections do not show up in "netstat". - If two concurrent builders try to listen on the same port (e.g. as part of a test), they no longer conflict with each other. This was inspired by the "PrivateNetwork" flag in systemd.
2012-05-30 Compress build logs on the fly using bzip2Eelco Dolstra2-11/+45
2012-05-29 Reserve some disk space for the garbage collectorEelco Dolstra7-9/+29
We can't open a SQLite database if the disk is full. Since this prevents the garbage collector from running when it's most needed, we reserve some dummy space that we can free just before doing a garbage collection. This actually revives some old code from the Berkeley DB days. Fixes #27.
2012-05-29 Add option ‘build-keep-log’ to enable/disable writing of build logsEelco Dolstra1-1/+4
Fixes #26.
2012-04-30 * Add an option ‘build-use-substitutes’, which can be set to ‘false’Eelco Dolstra4-3/+8
to disable use of substitutes; i.e., force building from source. Fixes Nix/221.
2012-04-30 Handle EPERM when creating a hard link for the chrootEelco Dolstra1-2/+5
There is a race condition when doing parallel builds with chroots and the immutable bit enabled. One process may call makeImmutable() before the other has called link(), in which case link() will fail with EPERM. We could retry or wrap the operation in a lock, but since this condition is rare and I'm lazy, we just use the existing copy fallback. Fixes #9.
2012-04-23 Merge pull request #2 from viric/masterEelco Dolstra1-0/+6
Again, adding the sync option
2012-04-16 Fix obscure race condition in GC root creationEelco Dolstra1-16/+18
This should fix rare Hydra errors of the form: error: symlinking `/nix/var/nix/gcroots/per-user/hydra/hydra-roots/7sfhs5fdmjxm8sqgcpd0pgcsmz1kq0l0-nixos-iso-0.1pre33785-33795' to `/nix/store/7sfhs5fdmjxm8sqgcpd0pgcsmz1kq0l0-nixos-iso-0.1pre33785-33795': File exists
2012-04-15 Close almost all file descriptors in the builderEelco Dolstra1-0/+3
This regression was accidentally introduced in 35355fc1fcffbe859395e360c0a6a1463f137d63.
2012-04-05 On Linux, pretend we're building on Linux 2.6Eelco Dolstra1-0/+11
Setting the UNAME26 personality causes "uname" to return "2.6.x", regardless of the kernel version. This improves determinism in a few misbehaved packages.
2012-03-26 Mac OS X fixEelco Dolstra1-0/+3
2012-03-26 Delete non-directory valid paths right awayEelco Dolstra1-16/+27
It's unlikely that rename() is faster than unlink() on a regular file or symlink, so don't bother.
2012-03-26 Make the garbage collector more concurrentEelco Dolstra3-21/+48
Make the garbage collector more concurrent by deleting valid paths outside the region where we're holding the global GC lock. This should greatly reduce the time during which new builds are blocked, since the deletion accounts for the vast majority of the time spent in the GC. To ensure that this is safe, the valid paths are invalidated and renamed to some arbitrary path while we're holding the lock. This ensures that we when we finally delete the path, it's not a (newly) valid or locked path.
2012-03-26 Remove the --max-links GC optionEelco Dolstra4-17/+2
We don't need this anymore now that current filesystems support more than 32,000 files in a directory.
2012-03-22 Fixing the default of sync-before-registeringLluís Batlle i Rossell1-1/+5
Setting 'false' as default, as suggested by Eelco. I also added a comment about the setting in the code.
2012-03-22 Adding a nix option to sync before registering a path, for non-ext*Lluís Batlle i Rossell1-0/+2
filesystems.
2012-03-20 nix-store --clear-failed-paths: Clear derivation outputsEelco Dolstra1-1/+3
If the argument to ‘nix-store --clear-failed-paths’ is a derivation, then clear the failed state of its outputs.
2012-03-18 Drop the externals directoryEelco Dolstra1-2/+2
Nix now requires SQLite and bzip2 to be pre-installed. SQLite is detected using pkg-config. We required DBD::SQLite anyway, so depending on SQLite is not a big problem. The --with-bzip2, --with-openssl and --with-sqlite flags are gone.
2012-03-13 Ensure that Perl processes delete their entry in the temproots directoryEelco Dolstra1-0/+12
By moving the destructor object to libstore.so, it's also run when download-using-manifests and nix-prefetch-url exit. This prevents them from cluttering /nix/var/nix/temproots with stale files.
2012-03-05 Set the close-on-exec flag on file descriptorsEelco Dolstra3-3/+5
2012-03-05 Don't leak a file descriptor in commonChildInit()Eelco Dolstra1-0/+1
2012-03-05 Restore progress indication during nix-copy-closureEelco Dolstra1-0/+2
2012-03-01 Remove dependency on sqlite3_table_column_metadataEelco Dolstra1-7/+0
Not all SQLite builds have the function sqlite3_table_column_metadata. We were only using it in a schema upgrade check for compatibility with databases that were probably never seen in the wild. So remove it.
2012-03-01 Fix an uninitialised variableEelco Dolstra1-0/+1
The variable ‘useChroot’ was not initialised properly. This caused random failures if using the build hook. Seen on Mac OS X 10.7 with Clang. Thanks to KolibriFX for finding this :-)
2012-02-18 Fix chroots buildsEelco Dolstra1-0/+16
Chroots are initialised by hard-linking inputs from the Nix store to the chroot. This doesn't work if the input has its immutable bit set, because it's forbidden to create hard links to immutable files. So temporarily clear the immutable bit when creating and destroying the chroot. Note that making regular files in the Nix store immutable isn't very reliable, since the bit can easily become cleared: for instance, if we run the garbage collector after running ‘nix-store --optimise’. So maybe we should only make directories immutable.
2012-02-15 On Linux, make the Nix store really read-only by using the immutable bitEelco Dolstra2-2/+31
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-15 Fix a broken guard around utime()Eelco Dolstra1-2/+5
Because of an outdated check for a timestamp of 0, we were calling utime() even when it wasn't necessary.
2012-02-15 Don't use deletePath() to delete a single fileEelco Dolstra1-1/+1
2012-02-09 Use data() instead of c_str() where appropriateEelco Dolstra4-9/+9
2011-12-30 * Oops.Eelco Dolstra1-1/+1
2011-12-30 * Move topoSortPaths() out of gc.cc.Eelco Dolstra2-36/+36
2011-12-30 * Reject a build if there is a cycle among the outputs. This isEelco Dolstra4-9/+24
necessary because existing code assumes that the references graph is acyclic.
2011-12-30 * Sync with the trunk.Eelco Dolstra3-20/+44
2011-12-25 * Make sure that lock files are cleaned up properly when buildingEelco Dolstra1-7/+7
through the build hook.
2011-12-22 * Oops.Eelco Dolstra1-1/+1
2011-12-22 * In the garbage collector, delete invalid paths before deletingEelco Dolstra1-11/+35
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.
2011-12-22 * Drop unnecessary call to canonPath() (nixStore is already canonical).Eelco Dolstra1-1/+1
2011-12-21 * Another case of lock file permissions being too liberal.Eelco Dolstra1-1/+1
2011-12-21 Revert previous commitShea Levy1-9/+0
It doesn't detect indirect references
2011-12-21 Detect and reject mutually-referential outputsShea Levy1-0/+9
There is probably a more efficient way to do this.
2011-12-20 * Fix the build.Eelco Dolstra1-1/+1
2011-12-16 * Sync with the trunk.Eelco Dolstra12-74/+157
2011-12-16 * importPath() -> importPaths(). Because of buffering of the inputEelco Dolstra6-29/+45
stream it's now necessary for the daemon to process the entire sequence of exported paths, rather than letting the client do it.