Fix incorrect influence info returned by a failing link() pagespec, that could lead to bad dependency handling in certian situations.

master
Joey Hess 2010-03-26 01:38:53 -04:00
parent 4cb464d6e5
commit 0d524ad672
4 changed files with 16 additions and 3 deletions

View File

@ -2215,7 +2215,7 @@ sub match_link ($$;@) {
my $from=exists $params{location} ? $params{location} : '';
my $links = $IkiWiki::links{$page};
return IkiWiki::FailReason->new("$page has no links", "" => 1)
return IkiWiki::FailReason->new("$page has no links", $page => $IkiWiki::DEPEND_LINKS, "" => 1)
unless $links && @{$links};
my $bestlink = IkiWiki::bestlink($from, $link);
foreach my $p (@{$links}) {
@ -2232,7 +2232,7 @@ sub match_link ($$;@) {
if match_glob($p_rel, $link, %params);
}
}
return IkiWiki::FailReason->new("$page does not link to $link", "" => 1);
return IkiWiki::FailReason->new("$page does not link to $link", $page => $IkiWiki::DEPEND_LINKS, "" => 1);
}
sub match_backlink ($$;@) {

2
debian/changelog vendored
View File

@ -17,6 +17,8 @@ ikiwiki (3.20100324) UNRELEASED; urgency=low
* Add --set-yaml switch for setting more complex config file options.
* filecheck: Fix bugs that prevented the pagespecs from matching when
not called by attachment plugin.
* Fix incorrect influence info returned by a failing link() pagespec,
that could lead to bad dependency handling in certian situations.
-- Joey Hess <joeyh@debian.org> Sat, 13 Mar 2010 14:48:10 -0500

View File

@ -15,4 +15,9 @@ dependency. But, it seems to me it should still be listed in
Then re-add the done link, and the dependency calc code breaks down,
not noticing that bugs dependeded on the page and needs to be updated.
Ok.. Turns out this was not a problem with the actual influences
calculation or dependency calculation code. Whew! `match_link`
just didn't set the influence correctly when failing. [[fixed|done]]
--[[Joey]]

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
use Test::More tests => 72;
use Test::More tests => 75;
BEGIN { use_ok("IkiWiki"); }
@ -54,6 +54,7 @@ $config{userdir}="";
$links{foo}=[qw{bar baz}];
$links{bar}=[];
$links{baz}=[];
$links{meh}=[];
$links{"bugs/foo"}=[qw{bugs/done}];
$links{"bugs/done"}=[];
$links{"bugs/bar"}=[qw{done}];
@ -82,6 +83,7 @@ ok(! pagespec_match("bar", ""), "empty pagespec should match nothing");
ok(! pagespec_match("bar", " "), "blank pagespec should match nothing");
ok(pagespec_match("ook", "link(blog/tags/foo)"), "link internal absolute success");
ok(pagespec_match("ook", "link(/blog/tags/foo)"), "link explicit absolute success");
ok(pagespec_match("meh", "!link(done)"), "negated failing match is a success");
$IkiWiki::pagectime{foo}=1154532692; # Wed Aug 2 11:26 EDT 2006
$IkiWiki::pagectime{bar}=1154532695; # after
@ -122,3 +124,7 @@ $i=pagespec_match("foo", "link(baz) and created_after(bar)")->influences;
is(join(",", sort keys %$i), 'bar,foo', "influences add up over OR");
$i=pagespec_match("foo", "!link(baz) and !created_after(bar)")->influences;
is(join(",", sort keys %$i), 'bar,foo', "influences unaffected by negation");
$i=pagespec_match("foo", "!link(baz) and !created_after(bar)")->influences;
is(join(",", sort keys %$i), 'bar,foo', "influences unaffected by negation");
$i=pagespec_match("meh", "!link(done)")->influences;
is(join(",", sort keys %$i), 'meh', "a negated, failing link test is successful, so the page is a link influence");