* 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.
This commit is contained in:
Eelco Dolstra 2009-06-13 16:30:58 +00:00
parent f24cf5d303
commit 14bc3ce3d6
3 changed files with 4 additions and 4 deletions

View file

@ -1432,7 +1432,7 @@ command-line argument. See <xref linkend='sec-standard-environment'
inputs.</para></listitem> inputs.</para></listitem>
<listitem><para>After the build, Nix sets the last-modified <listitem><para>After the build, Nix sets the last-modified
timestamp on all files in the build result to 0 (00:00:00 1/1/1970 timestamp on all files in the build result to 1 (00:00:01 1/1/1970
UTC), sets the group to the default group, and sets the mode of the UTC), sets the group to the default group, and sets the mode of the
file to 0444 or 0555 (i.e., read-only, with execute permission file to 0444 or 0555 (i.e., read-only, with execute permission
enabled if the file was originally executable). Note that possible enabled if the file was originally executable). Note that possible

View file

@ -153,7 +153,7 @@ void canonicalisePathMetaData(const Path & path, bool recurse)
if (st.st_mtime != 0) { if (st.st_mtime != 0) {
struct utimbuf utimbuf; struct utimbuf utimbuf;
utimbuf.actime = st.st_atime; utimbuf.actime = st.st_atime;
utimbuf.modtime = 0; utimbuf.modtime = 1; /* 1 second into the epoch */
if (utime(path.c_str(), &utimbuf) == -1) if (utime(path.c_str(), &utimbuf) == -1)
throw SysError(format("changing modification time of `%1%'") % path); throw SysError(format("changing modification time of `%1%'") % path);
} }

View file

@ -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 /* "Fix", or canonicalise, the meta-data of the files in a store path
after it has been built. In particular: after it has been built. In particular:
- the last modification date on each file is set to 0 (i.e., - the last modification date on each file is set to 1 (i.e.,
00:00:00 1/1/1970 UTC) 00:00:01 1/1/1970 UTC)
- the permissions are set of 444 or 555 (i.e., read-only with or - the permissions are set of 444 or 555 (i.e., read-only with or
without execute permission; setuid bits etc. are cleared) without execute permission; setuid bits etc. are cleared)
- the owner and group are set to the Nix user and group, if we're - the owner and group are set to the Nix user and group, if we're