[libxml-xpath-perl] 08/11: Add patch (plus test, yay!) to make "and" in XPath commutative

Axel Beckert abe at deuxchevaux.org
Fri Jan 15 23:14:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch master
in repository libxml-xpath-perl.

commit 2d420a3ff2b7361ee7dbb210b4ee3af817a2197b
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Fri Jan 15 23:50:33 2016 +0100

    Add patch (plus test, yay!) to make "and" in XPath commutative
    
    Patch and test by Niko Tyni
    
    Closes: #187583
---
 debian/changelog                          |  2 +
 debian/patches/make-and-commutative.patch | 62 +++++++++++++++++++++++++++++++
 debian/patches/series                     |  1 +
 3 files changed, 65 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 2cd439b..600580d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,6 +37,8 @@ libxml-xpath-perl (1.22-1) UNRELEASED; urgency=low
   * Add DEP-3 compliant patch headers to fix_comparison_bug_RT6363.patch.
   * Add "fallback => 1" to "use overload" in XML::XPath::Literal to fix
     broken stringification as suggested by Niko Tyni. (Closes: #315628)
+  * Add patch (plus test, yay!) by Niko Tyni to make "and" in XPath
+    commutative. (Closes: #187583)
 
   [ gregor herrmann ]
   * Strip trailing slash from metacpan URLs.
diff --git a/debian/patches/make-and-commutative.patch b/debian/patches/make-and-commutative.patch
new file mode 100644
index 0000000..ae56c18
--- /dev/null
+++ b/debian/patches/make-and-commutative.patch
@@ -0,0 +1,62 @@
+Description: "and" in XPath should be commutative
+ Fixes "Can't call method "size" on an undefined value" error.
+Author: Niko Tyni <ntyni at debian.org>
+Bug-Debian: https://bugs.debian.org/187583
+Bug: http://rt.cpan.org/Public/Bug/Display.html?id=32012
+Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=187583;filename=187583.patch;att=1;msg=22
+
+Index: libxml-xpath-perl/lib/XML/XPath/Step.pm
+===================================================================
+--- libxml-xpath-perl.orig/lib/XML/XPath/Step.pm	2016-01-15 22:09:20.328815966 +0100
++++ libxml-xpath-perl/lib/XML/XPath/Step.pm	2016-01-15 23:46:32.938438163 +0100
+@@ -131,6 +131,8 @@
+     my $from = shift; # context nodeset
+ 
+ #    warn "Step::evaluate called with ", $from->size, " length nodeset\n";
++    my $saved_context = $self->{pp}->get_context_set;
++    my $saved_pos = $self->{pp}->get_context_pos;
+ 
+     $self->{pp}->set_context_set($from);
+ 
+@@ -150,7 +152,8 @@
+ 
+ #    warn "Step::evaluate initial nodeset size: ", $initial_nodeset->size, "\n";
+ 
+-    $self->{pp}->set_context_set(undef);
++    $self->{pp}->set_context_set($saved_context);
++    $self->{pp}->set_context_pos($saved_pos);
+ 
+     $initial_nodeset->sort;
+ 
+Index: libxml-xpath-perl/t/32context.t
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ libxml-xpath-perl/t/32context.t	2016-01-15 23:46:32.938438163 +0100
+@@ -0,0 +1,27 @@
++use Test;
++BEGIN { plan tests => 4 }
++
++use XML::XPath;
++ok(1);
++
++my $xp = XML::XPath->new(ioref => *DATA);
++ok($xp);
++
++# Debian bug #187583, http://bugs.debian.org/187583
++# Check that evaluation doesn't lose the context information
++
++my $nodes = $xp->find("text/para/node()[position()=last() and preceding-sibling::important]");
++ok("$nodes", " has a preceding sibling.");
++
++$nodes = $xp->find("text/para/node()[preceding-sibling::important and position()=last()]");
++ok("$nodes", " has a preceding sibling.");
++
++__DATA__
++<text>
++  <para>I start the text here, I break
++the line and I go on, I <blink>twinkle</blink> and then I go on
++    again. 
++This is not a new paragraph.</para><para>This is a
++    <important>new</important> paragraph and 
++    <blink>this word</blink> has a preceding sibling.</para>
++</text>
diff --git a/debian/patches/series b/debian/patches/series
index 957cb65..79e4f4a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ fix_comparison_bug_RT6363.patch
 example.patch
 test.patch
 fix-stringification-overload.patch
+make-and-commutative.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libxml-xpath-perl.git



More information about the Pkg-perl-cvs-commits mailing list