]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Fix a bug that could lead to duplicate links being recorded for tags.
authorJoey Hess <joey@gnu.kitenet.net>
Sat, 3 Oct 2009 18:14:30 +0000 (14:14 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Sat, 3 Oct 2009 18:16:28 +0000 (14:16 -0400)
Here I was bitten by perl's aliasing of foreach variables
to the loop array contents, and match_link accidentially changed
the contents of %links.

In Jon's testcase, a tag added an absolute link, which was
made relative by the above bug, and then the link was added
again in preprocess, and turned into a duplicate.

IkiWiki.pm
debian/changelog
doc/bugs/brokenlinks_accumulates_duplicate_items.mdwn

index 974e369029291cd5351ed7c6321b48eb7c632d55..2637f60179c2732506158a495cdebbc46b4b8889 100644 (file)
@@ -2052,10 +2052,10 @@ sub match_link ($$;@) {
                else {
                        return IkiWiki::SuccessReason->new("$page links to page $p matching $link")
                                if match_glob($p, $link, %params);
                else {
                        return IkiWiki::SuccessReason->new("$page links to page $p matching $link")
                                if match_glob($p, $link, %params);
-                       $p=~s/^\///;
+                       my ($p_rel)=$p=~/^\/?(.*)/;
                        $link=~s/^\///;
                        $link=~s/^\///;
-                       return IkiWiki::SuccessReason->new("$page links to page $p matching $link")
-                               if match_glob($p, $link, %params);
+                       return IkiWiki::SuccessReason->new("$page links to page $p_rel matching $link")
+                               if match_glob($p_rel, $link, %params);
                }
        }
        return IkiWiki::FailReason->new("$page does not link to $link");
                }
        }
        return IkiWiki::FailReason->new("$page does not link to $link");
index b6383bacb33cda201bf2164d9389f799cba8223c..ca5409af7949f7a7e6eb900ab697892c57134e25 100644 (file)
@@ -8,6 +8,8 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low
     to the body tag.
   * Support RPC::XML 0.69's incompatable object instantiation method.
   * mirrorlist: Display nothing if list is empty.
     to the body tag.
   * Support RPC::XML 0.69's incompatable object instantiation method.
   * mirrorlist: Display nothing if list is empty.
+  * Fix a bug that could lead to duplicate links being recorded
+    for tags.
 
  -- Joey Hess <joeyh@debian.org>  Sun, 27 Sep 2009 17:40:03 -0400
 
 
  -- Joey Hess <joeyh@debian.org>  Sun, 27 Sep 2009 17:40:03 -0400
 
index 2091570d1858cbf89ebd88ec3e725ed602d2b2f6..d07b2381dec47830cf9faf6fc7354cf63f5dab03 100644 (file)
@@ -20,3 +20,6 @@ ikiwiki version 3.14159265.
 > source and the `.ikiwiki` directory to reproduce this. --[[Joey]] 
 
 >> Hi Joey, thanks for your response. I've reproduced it post rebuild and after having ran ikiwiki-transition and many refreshes (both resulting from content changes and otherwise) unfortunately, with ikiwiki 3.14159265 (different machine to above report, though). I will contact you privately to provide a git URL and a copy of my .ikiwiki. -- [[Jon]]
 > source and the `.ikiwiki` directory to reproduce this. --[[Joey]] 
 
 >> Hi Joey, thanks for your response. I've reproduced it post rebuild and after having ran ikiwiki-transition and many refreshes (both resulting from content changes and otherwise) unfortunately, with ikiwiki 3.14159265 (different machine to above report, though). I will contact you privately to provide a git URL and a copy of my .ikiwiki. -- [[Jon]]
+
+>>> Found the bug that was causing duplicates to get in, and fixed it.
+>>> [[done]] --[[Joey]]