]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Populate pagectime from mtime or inode change time, whichever is older
authorSimon McVittie <smcv@debian.org>
Tue, 9 Jun 2015 21:22:54 +0000 (22:22 +0100)
committerSimon McVittie <smcv@debian.org>
Tue, 9 Jun 2015 21:22:54 +0000 (22:22 +0100)
When building ikiwiki from a tarball, the mtime (conceptually, the
last modification date of the file) is preserved by tar, but the inode
change time (creation/metadata-change date of *this copy* of the file)
is not. This seems to lead to unstable sort ordering and
unreproducible builds.

The page can't possibly have been modified before it was created, so
we can assume that the modification date is an upper bound for the
creation date.

IkiWiki/Render.pm
debian/changelog

index d34e39e8aac7768b73c89527cefd6e9576d1545e..bdebaa64583501c87291877766dda5edddbab52a 100644 (file)
@@ -474,7 +474,11 @@ sub find_new_files ($) {
                        }
                        $pagecase{lc $page}=$page;
                        if (! exists $pagectime{$page}) {
-                               my $ctime=(srcfile_stat($file, 1))[10];
+                               my @stat=srcfile_stat($file, 1);
+                               # For the creation time of the page, take the
+                               # inode change time (not creation time!) or
+                               # the modification time, whichever is older.
+                               my $ctime=($stat[10] < $stat[9] ? $stat[10] : $stat[9]);
                                $pagectime{$page}=$ctime if defined $ctime;
                        }
                }
index f26cfdaab55530b6bd1468f1507f9c1d4e3aa6af..c5a007d092f0cc3c3f671543d4c144979111862e 100644 (file)
@@ -21,6 +21,8 @@ ikiwiki (3.20150330) UNRELEASED; urgency=medium
   * Make the attachment plugin work with CGI.pm 4.x (Closes: #786586;
     workaround for #786587 in libcgi-pm-perl)
   * Add a public-domain email icon from tango-icon-theme
+  * Populate pagectime from either mtime or inode change time,
+    whichever is older, again for more reproducible builds
 
  -- Joey Hess <id@joeyh.name>  Tue, 28 Apr 2015 12:24:08 -0400