about summary refs log tree commit diff
path: root/src/libstore/store.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-01T12·36+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-01T12·36+0000
commitdcc37c236c66ba463bd61fec23d046485d8a412f (patch)
treeb1a34feaf2a9a0ca0e0bad89c1671289de9e19d2 /src/libstore/store.hh
parenta6b65fd5e107416588a6572a88518d8816abcb12 (diff)
* nix-store, nix-instantiate: added an option `--add-root' to
  immediately add the result as a permanent GC root.  This is the only
  way to prevent a race with the garbage collector.  For instance, the
  old style

    ln -s $(nix-store -r $(nix-instantiate foo.nix)) \
      /nix/var/nix/gcroots/result

  has two time windows in which the garbage collector can interfere
  (by GC'ing the derivation and the output, respectively).  On the
  other hand,

    nix-store --add-root /nix/var/nix/gcroots/result -r \
      $(nix-instantiate --add-root /nix/var/nix/gcroots/drv \
        foo.nix)

  is safe.

* nix-build: use `--add-root' to prevent GC races.

Diffstat (limited to 'src/libstore/store.hh')
-rw-r--r--src/libstore/store.hh2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstore/store.hh b/src/libstore/store.hh
index dce4eb1d62ac..3a0b7a7131a2 100644
--- a/src/libstore/store.hh
+++ b/src/libstore/store.hh
@@ -62,6 +62,8 @@ void registerValidPath(const Transaction & txn,
 /* Throw an exception if `path' is not directly in the Nix store. */
 void assertStorePath(const Path & path);
 
+bool isStorePath(const Path & path);
+
 /* "Fix", or canonicalise, the meta-data of the files in a store path
    after it has been built.  In particular:
    - the last modification date on each file is set to 0 (i.e.,