From 0d524ad672333fd0bafa64e81e261fd297c25580 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Mar 2010 01:38:53 -0400 Subject: Fix incorrect influence info returned by a failing link() pagespec, that could lead to bad dependency handling in certian situations. --- IkiWiki.pm | 4 ++-- debian/changelog | 2 ++ doc/bugs/depends_simple_mixup.mdwn | 5 +++++ t/pagespec_match.t | 8 +++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 022bfe3bd..927d62940 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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 ($$;@) { diff --git a/debian/changelog b/debian/changelog index da1ab890e..b9a105552 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sat, 13 Mar 2010 14:48:10 -0500 diff --git a/doc/bugs/depends_simple_mixup.mdwn b/doc/bugs/depends_simple_mixup.mdwn index c2845240d..2603ff04c 100644 --- a/doc/bugs/depends_simple_mixup.mdwn +++ b/doc/bugs/depends_simple_mixup.mdwn @@ -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]] diff --git a/t/pagespec_match.t b/t/pagespec_match.t index 8b0be4e8a..ade9bca5a 100755 --- a/t/pagespec_match.t +++ b/t/pagespec_match.t @@ -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"); -- cgit v1.2.3