commit: df0ed79b1eb4fb3bfaaa1be33b384b68a109ea98 Author: Sobhan Mohammadpour <sobhan <AT> gentoo <DOT> org> AuthorDate: Tue Feb 6 17:08:01 2018 +0000 Commit: Sobhan Mohammadpour <sobhan <AT> gentoo <DOT> org> CommitDate: Tue Feb 6 17:08:01 2018 +0000 URL: https://gitweb.gentoo.org/proj/gnome.git/commit/?id=df0ed79b
dev-util/itstool: fix Package-Manager: Portage-2.3.23, Repoman-2.3.6 Manifest-Sign-Key: 0x7DF238CF0AA182E1 .../itstool/files/itstool-2.0.4-segfault.patch | 58 ++++++++++++++++++++++ ...tstool-2.0.4.ebuild => itstool-2.0.4-r1.ebuild} | 4 +- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/dev-util/itstool/files/itstool-2.0.4-segfault.patch b/dev-util/itstool/files/itstool-2.0.4-segfault.patch new file mode 100644 index 00000000..840daccd --- /dev/null +++ b/dev-util/itstool/files/itstool-2.0.4-segfault.patch @@ -0,0 +1,58 @@ +From 9b84c007a73e8275ca45762f1bfa3ab7c3a852e2 Mon Sep 17 00:00:00 2001 +From: Shaun McCance <sha...@redhat.com> +Date: Wed, 25 Oct 2017 12:10:03 -0400 +Subject: [PATCH] Be more careful about libxml2 memory management + +I think this fixes https://github.com/itstool/itstool/issues/17 +--- + itstool.in | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/itstool.in b/itstool.in +index c1d0585..a16eba9 100755 +--- a/itstool.in ++++ b/itstool.in +@@ -477,6 +477,7 @@ class Document (object): + if load_dtd: + ctxt.loadSubset(1) + if keep_entities: ++ ctxt.loadSubset(1) + ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD) + ctxt.replaceEntities(0) + else: +@@ -1043,6 +1044,7 @@ class Document (object): + if self._load_dtd: + ctxt.loadSubset(1) + if self._keep_entities: ++ ctxt.loadSubset(1) + ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD) + ctxt.replaceEntities(0) + else: +@@ -1069,7 +1071,9 @@ class Document (object): + ph_node = msg.get_placeholder(child.name).node + if self.has_child_elements(ph_node): + self.merge_translations(translations, None, ph_node, strict=strict) +- child.replaceNode(ph_node) ++ newnode = ph_node.copyNode(1) ++ newnode.setTreeDoc(self._doc) ++ child.replaceNode(newnode) + else: + repl = self.get_translated(ph_node, translations, strict=strict, lang=lang) + child.replaceNode(repl) +@@ -1084,10 +1088,15 @@ class Document (object): + (lang + ' ') if lang is not None else '', + msgstr.encode('utf-8'))) + self._xml_err = '' ++ ctxt.doc().freeDoc() + return node + retnode = node.copyNode(2) ++ retnode.setTreeDoc(self._doc) + for child in xml_child_iter(trnode): +- retnode.addChild(child.copyNode(1)) ++ newnode = child.copyNode(1) ++ newnode.setTreeDoc(self._doc) ++ retnode.addChild(newnode) ++ + ctxt.doc().freeDoc() + return retnode + diff --git a/dev-util/itstool/itstool-2.0.4.ebuild b/dev-util/itstool/itstool-2.0.4-r1.ebuild similarity index 89% rename from dev-util/itstool/itstool-2.0.4.ebuild rename to dev-util/itstool/itstool-2.0.4-r1.ebuild index b0bb4cf4..ec4e3a9a 100644 --- a/dev-util/itstool/itstool-2.0.4.ebuild +++ b/dev-util/itstool/itstool-2.0.4-r1.ebuild @@ -20,10 +20,12 @@ IUSE="" REQUIRED_USE="${PYTHON_REQUIRED_USE}" RDEPEND="${PYTHON_DEPS} - dev-libs/libxml2[${PYTHON_USEDEP}]" + dev-libs/libxml2[${PYTHON_USEDEP}]" DEPEND="${RDEPEND}" src_prepare() { + eapply "${FILESDIR}/${P}-segfault.patch" + python_fix_shebang . eapply_user eautoreconf }