about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-06-13T16·30+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-06-13T16·30+0000
commit14bc3ce3d6d5745717fa19b8b43b5fdd117ff757 (patch)
tree0b9cc8b99864046e037ac9e5dacf106980a789b0 /src/libstore
parentf24cf5d303dac3e82068f80091d2f312455ba8cf (diff)
* Canonicalise timestamps in the Nix store to 1 (1970-01-01 00:00:01
  UTC) rather than 0 (00:00:00).  1 is a better choice because some
  programs use 0 as a special value.  For instance, the Template
  Toolkit uses a timestamp of 0 to denote the non-existence of a file,
  so it barfs on files in the Nix store (see
  template-toolkit-nix-store.patch in Nixpkgs).  Similarly, Maya 2008
  fails to load script directories with a timestamp of 0 and can't be
  patched because it's closed source.

  This will also shut up those "implausibly old time stamp" GNU tar
  warnings.

Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/local-store.cc2
-rw-r--r--src/libstore/local-store.hh4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 51a32a3d1e5a..704bb1a06602 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -153,7 +153,7 @@ void canonicalisePathMetaData(const Path & path, bool recurse)
         if (st.st_mtime != 0) {
             struct utimbuf utimbuf;
             utimbuf.actime = st.st_atime;
-            utimbuf.modtime = 0;
+            utimbuf.modtime = 1; /* 1 second into the epoch */
             if (utime(path.c_str(), &utimbuf) == -1) 
                 throw SysError(format("changing modification time of `%1%'") % path);
         }
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index a422af3981b3..03b3b389f91e 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -190,8 +190,8 @@ void copyPath(const Path & src, const Path & dst);
 
 /* "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.,
-     00:00:00 1/1/1970 UTC)
+   - the last modification date on each file is set to 1 (i.e.,
+     00:00:01 1/1/1970 UTC)
    - the permissions are set of 444 or 555 (i.e., read-only with or
      without execute permission; setuid bits etc. are cleared)
    - the owner and group are set to the Nix user and group, if we're