about summary refs log tree commit diff
path: root/src/libstore
AgeCommit message (Collapse)AuthorFilesLines
2011-12-15 * Refactoring: move sink/source buffering into separate classes.Eelco Dolstra3-9/+6
* Buffer the HashSink. This speeds up hashing a bit because it prevents lots of calls to the hash update functions (e.g. nix-hash went from 9.3s to 8.7s of user time on the closure of my /var/run/current-system).
2011-12-14 * Buffer writes in FdSink. This significantly reduces the number ofEelco Dolstra1-0/+4
system calls / context switches when dumping a NAR and in the worker protocol.
2011-12-05 * Remove unnecessary quotes. showPaths() already adds quotes.Eelco Dolstra1-1/+1
2011-12-02 * In ‘nix-store --verify --check-contents’, repair missing hashesEelco Dolstra1-4/+20
rather than complain about them.
2011-12-01 * When doing "nix-store --add-fixed" without "--recursive" via the NixEelco Dolstra2-4/+2
daemon (which is an error), print a nicer error message than "Connection reset by peer" or "broken pipe". * In the daemon, log errors that occur during request parameter processing.
2011-11-29 * Get rid of some superfluous error messages if a substituter fails.Eelco Dolstra1-15/+6
* Say "fetch" instead of "substitute".
2011-11-23 * Add an API function exportPaths() that provides the functionality ofEelco Dolstra3-1/+18
‘nix-store --export’. * Add a Perl module that provides the functionality of ‘nix-copy-closure --to’. This is used by build-remote.pl so it no longer needs to start a separate nix-copy-closure process. Also, it uses the Perl API to do the export, so it doesn't need to start a separate nix-store process either. As a result, nix-copy-closure and build-remote.pl should no longer fail on very large closures due to an "Argument list too long" error. (Note that having very many dependencies in a single derivation can still fail because the environment can become too large. Can't be helped though.)
2011-11-22 * Move initialisation of variables like nixConfDir from libmain toEelco Dolstra3-2/+43
libstore so that the Perl bindings can use it as well. It's vital that the Perl bindings use the configuration file, because otherwise nix-copy-closure will fail with a ‘database locked’ message if the value of ‘use-sqlite-wal’ is changed from the default.
2011-11-21 nix: add /etc/hosts with localhost entry to chroot builds.Rob Vermaas1-0/+3
2011-11-07 * Boldly make SQLite WAL mode the default again. Hopefully theEelco Dolstra1-4/+3
intermittent problems are gone by now. WAL mode is preferrable because it does way fewer fsyncs.
2011-09-12 * Ouch. A store upgrade could cause a substituter to be triggered,Eelco Dolstra3-5/+6
causing a deadlock.
2011-08-31 * Eliminate all uses of the global variable ‘store’ from libstore.Eelco Dolstra8-61/+66
This should also fix: nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr<T>::operator->() const [with T = nix::StoreAPI]: Assertion `px != 0' failed. which was caused by hashDerivationModulo() calling the ‘store’ object (during store upgrades) before openStore() assigned it.
2011-07-20 * Fix a huuuuge security hole in the Nix daemon. It didn't check thatEelco Dolstra7-16/+177
derivations added to the store by clients have "correct" output paths (meaning that the output paths are computed by hashing the derivation according to a certain algorithm). This means that a malicious user could craft a special .drv file to build *any* desired path in the store with any desired contents (so long as the path doesn't already exist). Then the attacker just needs to wait for a victim to come along and install the compromised path. For instance, if Alice (the attacker) knows that the latest Firefox derivation in Nixpkgs produces the path /nix/store/1a5nyfd4ajxbyy97r1fslhgrv70gj8a7-firefox-5.0.1 then (provided this path doesn't already exist) she can craft a .drv file that creates that path (i.e., has it as one of its outputs), add it to the store using "nix-store --add", and build it with "nix-store -r". So the fake .drv could write a Trojan to the Firefox path. Then, if user Bob (the victim) comes along and does $ nix-env -i firefox $ firefox he executes the Trojan injected by Alice. The fix is to have the Nix daemon verify that derivation outputs are correct (in addValidPath()). This required some refactoring to move the hash computation code to libstore.
2011-06-30 Add support for the `build-timeout' and `--timeout' options.Ludovic Courtès3-4/+35
2011-04-19 * Handle error messages from the Nix worker containing the `%'Eelco Dolstra1-1/+1
character. (Nix/216)
2010-12-17 * Do a short sleep after SQLITE_BUSY.Eelco Dolstra1-0/+11
2010-12-17 * Propagate the "100" exit status for failed builds through the NixEelco Dolstra2-3/+6
daemon.
2010-12-14 * I forgot to catch SQLiteBusy in registerValidPaths(). SoEelco Dolstra1-38/+31
registerValidPaths() now handles busy errors and registerValidPath() is simply a wrapper around it.
2010-12-13 * nix-instantiate: return exit status 100 to denote a permanent buildEelco Dolstra1-3/+16
failure. The build hook can use this to distinguish between transient and permanent failures on the remote side.
2010-12-13 * Create /nix/var/nix/db if it's missing.Eelco Dolstra1-0/+1
2010-12-13 * Update some comments.Eelco Dolstra1-1/+1
2010-12-08 * Ignore the result of sqlite3_reset().Eelco Dolstra1-3/+4
2010-12-06 * `nix-store --verify --check-contents': don't hold the global GC lockEelco Dolstra2-11/+49
while checking the contents, since this operation can take a very long time to finish. Also, fill in missing narSize fields in the DB while doing this.
2010-12-05 * Retry a transaction if SQLite returns SQLITE_BUSY. This can happenEelco Dolstra1-61/+83
even with a very long busy timeout, because SQLITE_BUSY is also returned to resolve deadlocks. This should get rid of random "database is locked" errors. This is kind of hard to test though. * Fix a horrible bug in deleteFromStore(): deletePathWrapped() should be called after committing the transaction, not before, because the commit might not succeed.
2010-11-17 * Before a build, show the disk space that the downloaded store pathsEelco Dolstra6-6/+9
will approximately require.
2010-11-17 * Add an operation `nix-store -q --size'.Eelco Dolstra2-2/+13
2010-11-17 * Implement RemoteStore::queryPathInfo().Eelco Dolstra2-1/+14
2010-11-16 * Store the size of a store path in the database (to be precise, theEelco Dolstra11-78/+124
size of the NAR serialisation of the path, i.e., `nix-store --dump PATH'). This is useful for Hydra.
2010-11-16 * Sync with the trunk.Eelco Dolstra1-3/+3
2010-10-14 * Wrap deleteFromStore() in a transaction. Otherwise there might be aEelco Dolstra2-8/+13
race with other processes that add new referrers to a path, resulting in the garbage collector crashing with "foreign key constraint failed". (Nix/4) * Make --gc --print-dead etc. interruptible.
2010-10-04 * Make sure that config.h is included before the system headers,Eelco Dolstra1-3/+3
because it defines _FILE_OFFSET_BITS. Without this, on OpenSolaris the system headers define it to be 32, and then the 32-bit stat() ends up being called with a 64-bit "struct stat", or vice versa. This also ensures that we get 64-bit file sizes everywhere. * Remove the redundant call to stat() in parseExprFromFile(). The file cannot be a symlink because that's the exit condition of the loop before.
2010-09-01 * Only do "pragma journal_mode = ..." if the current journal modeEelco Dolstra1-1/+10
differs from the desired mode. There is an open SQLite ticket `Executing "PRAGMA journal_mode" may delete journal file while it is in use.'
2010-08-31 * Always print hook output on stderr, even if --no-build-output isEelco Dolstra1-4/+12
set. * In the build hook, print a trace message to allow Hydra to pick up the name of the remote machine used for the build.
2010-08-31 `nix-store --verify' improvements:Eelco Dolstra3-20/+62
* If a path has disappeared, check its referrers first, and don't try to invalidate paths that have valid referrers. Otherwise we get a foreign key constraint violation. * Read the whole Nix store directory instead of statting each valid path, which is slower. * Acquire the global GC lock.
2010-08-30 * When using the build hook, distinguish between the stderr of theEelco Dolstra4-21/+32
hook script proper, and the stdout/stderr of the builder. Only the latter should be saved in /nix/var/log/nix/drvs. * Allow the verbosity to be set through an option. * Added a flag --quiet to lower the verbosity level.
2010-08-30 * Disable the GC reachability check for now (when creating new roots),Eelco Dolstra1-1/+1
as it's hopelessly inefficient.
2010-08-27 * Experimental feature: allow a derivation to tell the build hook thatEelco Dolstra1-2/+10
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-25 * Made the build hook mechanism more efficient. Rather than startingEelco Dolstra1-203/+187
the hook every time we want to ask whether we can run a remote build (which can be very often), we now reuse a hook process for answering those queries until it accepts a build. So if there are N derivations to be built, at most N hooks will be started.
2010-08-24 * Don't complain if the stored hash of a path is zero (unknown).Eelco Dolstra1-2/+3
2010-08-24 * Handle the unlikely case where a derivation has no dependencies atEelco Dolstra1-1/+4
all.
2010-08-24 * Sync with the trunk.Eelco Dolstra2-1/+4
2010-08-12 * Make --cores work when building through the Nix daemon.Eelco Dolstra2-1/+4
2010-08-04 * Sync with the trunk.Eelco Dolstra4-0/+13
2010-08-04 * Use SQLite 3.7.0's write-ahead logging (WAL mode). This is a lotEelco Dolstra1-2/+12
faster than the old mode when fsyncs are enabled, because it only performs an fsync() when doing a checkpoint, rather than at every commit. Some timings for doing a "nix-instantiate /etc/nixos/nixos -A system" after modifying the stdenv setup script: 42.5s - SQLite 3.6.23 with truncate mode and fsync 3.4s - SQLite 3.6.23 with truncate mode and no fsync 32.1s - SQLite 3.7.0 with truncate mode and fsync 16.8s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint every 1000 pages 8.3s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint every 8192 pages 1.7s - SQLite 3.7.0 with WAL mode and no fsync The default is now to use WAL mode with fsyncs. Because WAL doesn't work on remote filesystems such as NFS (as it uses shared memory), truncate mode can be re-enabled by setting the "use-sqlite-wal" option to false.
2010-08-04 * Allow derivations to hint that they should not be built remotelyEelco Dolstra1-23/+39
using the build hook mechanism, by setting the derivation attribute "preferLocalBuild" to true. This has a few use cases: - The user environment builder. Since it just creates a bunch of symlinks without much computation, there is no reason to do it remotely. In fact, doing it remotely requires the entire closure of the user environment to be copied to the remote machine, which is extremely wasteful. - `fetchurl'. Performing the download on a remote machine and then copying it to the local machine involves twice as much network traffic as performing the download locally, and doesn't save any CPU cycles on the local machine.
2010-06-24 Include <cstring> to ensure that strcpy(), strlen(), and memset() are declared.Peter Simons2-0/+4
An "using namespace std" was added locally in those functions that refer to names from <cstring>. That is not pretty, but it's a very portable solution, because strcpy() and friends will be found in both the 'std' and in the global namespace.
2010-06-23 Added support for passing an (impure) NIX_BUILD_CORES variable to build ↵Peter Simons3-0/+9
expressions. This patch adds the configuration file variable "build-cores" and the command line argument "--cores". These settings specify the number of CPU cores to utilize for parallel building within a job, i.e. by passing an appropriate "-j" flag to GNU Make. The default value is 1, which means that parallel building is *disabled*. If the number of build cores is specified as 0 (synonymously: "guess" or "auto"), then the actual value is supposed to be auto-detected by builders at run-time, i.e by calling the nproc(1) utility from coreutils. The environment variable $NIX_BUILD_CORES is available to builders, but the contents of that variable does *not* influence the hash that goes into the $out store path, i.e. the number of build cores to be utilized can be changed at will without requiring any re-builds.
2010-06-21 * Okay, putting a lock on the temporary directory used by importPath()Eelco Dolstra2-6/+20
doesn't work because the garbage collector doesn't actually look at locks. So r22253 was stupid. Use addTempRoot() instead. Also, locking the temporary directory in exportPath() was silly because it isn't even in the store.
2010-06-21 * Sync with the trunk.Eelco Dolstra4-4/+20
2010-06-14 * In importPath() and exportPath(), lock the temporary directory toEelco Dolstra1-0/+4
prevent it from being deleted by the garbage collector.