]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Detect invalid pagespecs and do not merge them in add_depends,
authorJoey Hess <joey@kodama.kitenet.net>
Mon, 17 Mar 2008 18:04:59 +0000 (14:04 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Mon, 17 Mar 2008 18:04:59 +0000 (14:04 -0400)
  as that can result in a broken merged pagespec that matches nothing.

IkiWiki.pm
debian/changelog

index 668de7e9368be67c12425e8acb13c2355e548fe1..bd804269dd16fee904743a59bd9ce33428479e4b 100644 (file)
@@ -1106,6 +1106,8 @@ sub add_depends ($$) { #{{{
        my $page=shift;
        my $pagespec=shift;
        
+       return unless pagespec_valid($pagespec);
+
        if (! exists $depends{$page}) {
                $depends{$page}=$pagespec;
        }
@@ -1234,6 +1236,17 @@ sub pagespec_match ($$;@) { #{{{
        return $ret;
 } #}}}
 
+sub pagespec_valid ($) { #{{{
+       my $spec=shift;
+
+       # used by generated code
+       my $page="";
+       my @params;
+
+       eval pagespec_translate($spec);
+       return ! $@;
+} #}}}
+
 package IkiWiki::FailReason;
 
 use overload ( #{{{
index c9fd64a2a977d3ac851b9d0e5063d076477e38fb..dc950790feacf875b46f93e0d67cc30b4792cc1a 100644 (file)
@@ -45,6 +45,8 @@ ikiwiki (2.41) UNRELEASED; urgency=low
   * external: Add getargv and setargv methods to allow access to ikiwiki's
     @ARGV.
   * Correct bug in encoding of %pagestate keys, fixes edittemplate.
+  * Detect invalid pagespecs and do not merge them in add_depends,
+    as that can result in a broken merged pagespec that matches nothing.
 
  -- martin f. krafft <madduck@debian.org>  Sun, 02 Mar 2008 17:46:38 +0100