diff options
author | Simon McVittie <smcv@debian.org> | 2015-06-09 22:22:54 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2015-06-09 22:22:54 +0100 |
commit | 2fe003dac47259aabfc7603ce60ead5a4030c80c (patch) | |
tree | 3c1ce4c5d9f46fef912a080f0ae85be7007e87bc /IkiWiki/Render.pm | |
parent | b6388d6fbd807f742df25f3fc15ae67360f8e6cc (diff) | |
download | ikiwiki-2fe003dac47259aabfc7603ce60ead5a4030c80c.tar ikiwiki-2fe003dac47259aabfc7603ce60ead5a4030c80c.tar.gz |
Populate pagectime from mtime or inode change time, whichever is older
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.
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r-- | IkiWiki/Render.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index d34e39e8a..bdebaa645 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -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; } } |