]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Fix crash that can occur when only_committed_changes is set and a file is deleted...
authorJoey Hess <joey@kitenet.net>
Fri, 26 Sep 2014 22:55:09 +0000 (18:55 -0400)
committerJoey Hess <joey@kitenet.net>
Fri, 26 Sep 2014 22:55:09 +0000 (18:55 -0400)
srcfile_stat got called on a file from the underlay that no longer existed.

I am not 100% sure of the circumstances of that; I was able to reproduce
the bug but neglected to snapshot the tree, and then accidentially
got it to stop crashing. I know that a transient tag page got deleted using
the web interface to trigger the crash.

It seems that process_changed_files must have returned the file, despite it
being deleted. And since the file was not checked into git, it seems it
must have not been included in @IkiWiki::underlayfiles, which would have
caused process_changed_files to not return it.

I do not know why a transient tag page would not be in
@IkiWiki::underlayfiles. There is a bug here that I don't understand.

This is just a workaround -- run srcfile_stat such that it won't crash,
and if it is unable to stat a file, find_changed knows it's not changed,
so it's ok to skip it.

Also made find_new_files run srcfile_stat such that it won't crash, just
because I was there.

IkiWiki/Render.pm
debian/changelog

index 825c077daa7416483f731cc0e31ed4add4444fab..9d6f636a25c372019eb56075029e820e3d3113a5 100644 (file)
@@ -473,7 +473,8 @@ sub find_new_files ($) {
                        }
                        $pagecase{lc $page}=$page;
                        if (! exists $pagectime{$page}) {
-                               $pagectime{$page}=(srcfile_stat($file))[10];
+                               my $ctime=(srcfile_stat($file, 1))[10];
+                               $pagectime{$page}=$ctime if defined $ctime;
                        }
                }
        }
@@ -533,10 +534,11 @@ sub find_changed ($) {
        my @internal_changed;
        foreach my $file (@$files) {
                my $page=pagename($file);
-               my ($srcfile, @stat)=srcfile_stat($file);
-               if (! exists $pagemtime{$page} ||
-                   $stat[9] > $pagemtime{$page} ||
-                   $forcerebuild{$page}) {
+               my ($srcfile, @stat)=srcfile_stat($file, 1);
+               if (defined $srcfile && 
+                   (! exists $pagemtime{$page} ||
+                    $stat[9] > $pagemtime{$page} ||
+                    $forcerebuild{$page})) {
                        $pagemtime{$page}=$stat[9];
 
                        if (isinternal($page)) {
index 20eca01554a4fe753d632ff31f9bc5e29bd5fde6..d339736911853de0ed42e0a8946db8464d4a4d04 100644 (file)
@@ -1,8 +1,13 @@
 ikiwiki (3.20140917) UNRELEASED; urgency=medium
 
+  [ Simon McVittie ]
   * Build-depend on libmagickcore-6.q16-2-extra | libmagickcore-extra
     so we can thumbnail SVGs in the docwiki
 
+  [ Joey Hess ]
+  * Fix crash that can occur when only_committed_changes is set and a
+    file is deleted from the underlay.
+
  -- Simon McVittie <smcv@debian.org>  Tue, 16 Sep 2014 11:21:16 +0100
 
 ikiwiki (3.20140916) unstable; urgency=low