fix canonicalize already defined by glibc

This commit is contained in:
lyn1001 2022-01-21 12:28:19 +08:00
parent 2bbf19f412
commit dd3a31866f
2 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,32 @@
From 7a74cdbe4538e964023e5a0fdca58d8af708b91e Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Thu, 29 Oct 2020 11:50:11 -0400
Subject: [PATCH 1/2] fix: avoid collision with glibc's canonicalize() method
Closes #2105
---
ext/nokogiri/xml_document.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ext/nokogiri/xml_document.c b/ext/nokogiri/xml_document.c
index 3a8ba06e3e..6c010b5438 100644
--- a/ext/nokogiri/xml_document.c
+++ b/ext/nokogiri/xml_document.c
@@ -506,7 +506,7 @@ static int block_caller(void * ctx, xmlNodePtr _node, xmlNodePtr _parent)
* The block must return a non-nil, non-false value if the +obj+ passed in
* should be included in the canonicalized document.
*/
-static VALUE canonicalize(int argc, VALUE* argv, VALUE self)
+static VALUE nokogiri_xml_document_canonicalize(int argc, VALUE* argv, VALUE self)
{
VALUE mode;
VALUE incl_ns;
@@ -587,7 +587,7 @@ void init_xml_document()
rb_define_method(klass, "encoding", encoding, 0);
rb_define_method(klass, "encoding=", set_encoding, 1);
rb_define_method(klass, "version", version, 0);
- rb_define_method(klass, "canonicalize", canonicalize, -1);
+ rb_define_method(klass, "canonicalize", nokogiri_xml_document_canonicalize, -1);
rb_define_method(klass, "dup", duplicate_document, -1);
rb_define_method(klass, "url", url, 0);
rb_define_method(klass, "create_entity", create_entity, -1);

View File

@ -7,7 +7,7 @@
Summary: An HTML, XML, SAX, and Reader parser
Name: rubygem-%{gem_name}
Version: %{mainver}
Release: 4
Release: 5
License: MIT
URL: https://nokogiri.org
Source0: https://rubygems.org/gems/%{gem_name}-%{mainver}%{?prever}.gem
@ -20,6 +20,7 @@ Patch3: CVE-2021-41098-1.patch
Patch4: CVE-2021-41098-2.patch
Patch5: fix-test-push-parser-fail.patch
Patch6: fix-test-node-fail.patch
Patch7: fix-canonicalize-already-defined-by-glibc.patch
BuildRequires: ruby(release) ruby(rubygems) rubygem(minitest) rubygems-devel
Obsoletes: ruby-%{gem_name} <= 1.5.2-2
BuildRequires: gcc rubygem(pkg-config) libxml2-devel libxslt-devel ruby-devel
@ -61,7 +62,7 @@ cd %{gem_name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch7 -p1
#The file exists only in the source code directory,not in the GEM.
cd $TOPDIR/%{gem_name}-%{version}
%patch3 -p1
@ -162,6 +163,9 @@ popd
%{gem_dir}/doc/%{gem_name}-%{mainver}%{?prever}/
%changelog
* Fri Jan 07 2022 liyanan <liyanan32@huawei.com> - 1.10.5-5
- fix canonicalize already defined by glibc
* Fri Jan 07 2022 wangkai <wangkai385@huawei.com> - 1.10.5-4
- fix compile failed