dev-libs/libxslt: Sync with Gentoo

It's from Gentoo commit efd19cfcc676b38196c881d607768a8dca5aa5c2.
This commit is contained in:
Flatcar Buildbot 2024-07-16 11:19:25 +00:00 committed by Mathieu Tortuyaux
parent 740f98f7aa
commit d39396502c
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
7 changed files with 448 additions and 5 deletions

View File

@ -1 +1,2 @@
DIST libxslt-1.1.39.tar.xz 1578216 BLAKE2B 7c87b769d345fc99a966bea6b4e94533fa211dc3a987ce013a03eefb05dde73ef75526bdecf7d32d8c77112232096fb22d8ec4f0a781b9f59d0422a2db75df01 SHA512 c0c99dc63f8b2acb6cc3ad7ad684ffa2a427ee8d1740495cbf8a7c9b9c8679f96351b4b676c73ccc191014db4cb4ab42b9a0070f6295565f39dbc665c5c16f89 DIST libxslt-1.1.39.tar.xz 1578216 BLAKE2B 7c87b769d345fc99a966bea6b4e94533fa211dc3a987ce013a03eefb05dde73ef75526bdecf7d32d8c77112232096fb22d8ec4f0a781b9f59d0422a2db75df01 SHA512 c0c99dc63f8b2acb6cc3ad7ad684ffa2a427ee8d1740495cbf8a7c9b9c8679f96351b4b676c73ccc191014db4cb4ab42b9a0070f6295565f39dbc665c5c16f89
DIST libxslt-1.1.41.tar.xz 1573868 BLAKE2B 2228a4074f257edd4fa0ebb2a713b035b780b19398ba9208dedb0d0cec6777129c9bb08a80494b657a4238bea228bd752761118a0022f56d71cc1302838b1733 SHA512 b9f94d1c00dfb9f731c6c424a0d3f07fb0a37935048b26618e5405c3890d1d40c832420117de4d5363a90ab4809f77f6e566013ce7858cc88e0905709ca0f6fe

View File

@ -0,0 +1,93 @@
https://gitlab.gnome.org/GNOME/libxslt/-/commit/8d456f03b6b6661edfb0a3f1bc5abdc9597f60e7
From 8d456f03b6b6661edfb0a3f1bc5abdc9597f60e7 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 2 Jul 2024 22:27:02 +0200
Subject: [PATCH] utils: Don't use deprecated xmlCharEncodingHandler member
---
libxslt/xsltutils.c | 44 ++++++++++++++++++++------------------------
1 file changed, 20 insertions(+), 24 deletions(-)
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index 3705d28f..d493905b 100644
--- a/libxslt/xsltutils.c
+++ b/libxslt/xsltutils.c
@@ -1750,13 +1750,12 @@ xsltSaveResultToFilename(const char *URL, xmlDocPtr result,
XSLT_GET_IMPORT_PTR(encoding, style, encoding)
if (encoding != NULL) {
- xmlCharEncodingHandlerPtr encoder;
+ xmlCharEncodingHandlerPtr encoder = NULL;
- encoder = xmlFindCharEncodingHandler((char *)encoding);
- if ((encoder != NULL) &&
- (xmlStrEqual((const xmlChar *)encoder->name,
- (const xmlChar *) "UTF-8")))
- encoder = NULL;
+ /* Don't use UTF-8 dummy encoder */
+ if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) &&
+ (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0))
+ encoder = xmlFindCharEncodingHandler((char *) encoding);
buf = xmlOutputBufferCreateFilename(URL, encoder, compression);
} else {
buf = xmlOutputBufferCreateFilename(URL, NULL, compression);
@@ -1793,13 +1792,12 @@ xsltSaveResultToFile(FILE *file, xmlDocPtr result, xsltStylesheetPtr style) {
XSLT_GET_IMPORT_PTR(encoding, style, encoding)
if (encoding != NULL) {
- xmlCharEncodingHandlerPtr encoder;
+ xmlCharEncodingHandlerPtr encoder = NULL;
- encoder = xmlFindCharEncodingHandler((char *)encoding);
- if ((encoder != NULL) &&
- (xmlStrEqual((const xmlChar *)encoder->name,
- (const xmlChar *) "UTF-8")))
- encoder = NULL;
+ /* Don't use UTF-8 dummy encoder */
+ if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) &&
+ (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0))
+ encoder = xmlFindCharEncodingHandler((char *) encoding);
buf = xmlOutputBufferCreateFile(file, encoder);
} else {
buf = xmlOutputBufferCreateFile(file, NULL);
@@ -1837,13 +1835,12 @@ xsltSaveResultToFd(int fd, xmlDocPtr result, xsltStylesheetPtr style) {
XSLT_GET_IMPORT_PTR(encoding, style, encoding)
if (encoding != NULL) {
- xmlCharEncodingHandlerPtr encoder;
+ xmlCharEncodingHandlerPtr encoder = NULL;
- encoder = xmlFindCharEncodingHandler((char *)encoding);
- if ((encoder != NULL) &&
- (xmlStrEqual((const xmlChar *)encoder->name,
- (const xmlChar *) "UTF-8")))
- encoder = NULL;
+ /* Don't use UTF-8 dummy encoder */
+ if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) &&
+ (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0))
+ encoder = xmlFindCharEncodingHandler((char *) encoding);
buf = xmlOutputBufferCreateFd(fd, encoder);
} else {
buf = xmlOutputBufferCreateFd(fd, NULL);
@@ -1880,13 +1877,12 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len,
XSLT_GET_IMPORT_PTR(encoding, style, encoding)
if (encoding != NULL) {
- xmlCharEncodingHandlerPtr encoder;
+ xmlCharEncodingHandlerPtr encoder = NULL;
- encoder = xmlFindCharEncodingHandler((char *)encoding);
- if ((encoder != NULL) &&
- (xmlStrEqual((const xmlChar *)encoder->name,
- (const xmlChar *) "UTF-8")))
- encoder = NULL;
+ /* Don't use UTF-8 dummy encoder */
+ if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) &&
+ (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0))
+ encoder = xmlFindCharEncodingHandler((char *) encoding);
buf = xmlAllocOutputBuffer(encoder);
if (buf == NULL)
xmlCharEncCloseFunc(encoder);
--
GitLab

View File

@ -0,0 +1,40 @@
https://gitlab.gnome.org/GNOME/libxslt/-/commit/a85bd17ec52793b33074f0f785c3d989feb20170
From a85bd17ec52793b33074f0f785c3d989feb20170 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Fri, 21 Jun 2024 15:07:18 +0200
Subject: [PATCH] extensions: Readd call to xmlCheckFilename with older libxml2
Fix spurious warning with libxml2 before 2.13.0 caused by 014b2892.
Fixes #113.
---
libxslt/extensions.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libxslt/extensions.c b/libxslt/extensions.c
index 05cdf354..d3d61543 100644
--- a/libxslt/extensions.c
+++ b/libxslt/extensions.c
@@ -415,6 +415,19 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
module_filename, URI);
#endif
+#if LIBXML_VERSION < 21300
+ if (1 != xmlCheckFilename(module_filename)) {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xmlCheckFilename failed for plugin: %s\n", module_filename);
+#endif
+
+ xmlFree(ext_name);
+ return (-1);
+ }
+#endif
+
/* attempt to open the module */
m = xmlModuleOpen(module_filename, 0);
if (NULL == m) {
--
GitLab

View File

@ -0,0 +1,171 @@
https://gitlab.gnome.org/GNOME/libxslt/-/issues/116
https://gitlab.gnome.org/GNOME/libxslt/-/commit/081cd6e97a620d035ed7df35e998e2d288bc7862
From 081cd6e97a620d035ed7df35e998e2d288bc7862 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Mon, 1 Jul 2024 13:21:14 +0200
Subject: [PATCH] transform: Handle filesystem paths after libxml2 changes
After changes in libxml2 2.13, base URIs and resolved URIs can be
filesystem paths.
Check for invalid URIs and remove fragment before resolving URI in
xsltDocumentFunction.
Handle filesystem paths in xsltCheckRead.
Should fix #116.
---
libxslt/functions.c | 64 ++++++++++++++++++++++++++-------------------
libxslt/security.c | 13 +++++++++
2 files changed, 50 insertions(+), 27 deletions(-)
diff --git a/libxslt/functions.c b/libxslt/functions.c
index 0c9dec43..d54f8f48 100644
--- a/libxslt/functions.c
+++ b/libxslt/functions.c
@@ -96,11 +96,10 @@ xsltXPathFunctionLookup (void *vctxt,
************************************************************************/
static void
-xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
+xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt,
+ const xmlChar* URI, const xmlChar *fragment)
{
xsltTransformContextPtr tctxt;
- xmlURIPtr uri;
- xmlChar *fragment = NULL;
xsltDocumentPtr idoc; /* document info */
xmlDocPtr doc;
xmlXPathContextPtr xptrctxt = NULL;
@@ -115,26 +114,7 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
goto out_fragment;
}
- uri = xmlParseURI((const char *) URI);
- if (uri == NULL) {
- xsltTransformError(tctxt, NULL, NULL,
- "document() : failed to parse URI\n");
- goto out_fragment;
- }
-
- /*
- * check for and remove fragment identifier
- */
- fragment = (xmlChar *)uri->fragment;
- if (fragment != NULL) {
- xmlChar *newURI;
- uri->fragment = NULL;
- newURI = xmlSaveUri(uri);
- idoc = xsltLoadDocument(tctxt, newURI);
- xmlFree(newURI);
- } else
- idoc = xsltLoadDocument(tctxt, URI);
- xmlFreeURI(uri);
+ idoc = xsltLoadDocument(tctxt, URI);
if (idoc == NULL) {
if ((URI == NULL) ||
@@ -194,7 +174,6 @@ out_fragment:
if (resObj == NULL)
resObj = xmlXPathNewNodeSet(NULL);
valuePush(ctxt, resObj);
- xmlFree(fragment);
}
/**
@@ -210,7 +189,8 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
{
xmlXPathObjectPtr obj, obj2 = NULL;
xmlChar *base = NULL, *URI;
-
+ xmlChar *newURI = NULL;
+ xmlChar *fragment = NULL;
if ((nargs < 1) || (nargs > 2)) {
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
@@ -292,7 +272,32 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
} else {
xsltTransformContextPtr tctxt;
+ xmlURIPtr uri;
+ const xmlChar *url;
+
tctxt = xsltXPathGetTransformContext(ctxt);
+
+ url = obj->stringval;
+
+ uri = xmlParseURI((const char *) url);
+ if (uri == NULL) {
+ xsltTransformError(tctxt, NULL, NULL,
+ "document() : failed to parse URI '%s'\n", url);
+ valuePush(ctxt, xmlXPathNewNodeSet(NULL));
+ goto error;
+ }
+
+ /*
+ * check for and remove fragment identifier
+ */
+ fragment = (xmlChar *)uri->fragment;
+ if (fragment != NULL) {
+ uri->fragment = NULL;
+ newURI = xmlSaveUri(uri);
+ url = newURI;
+ }
+ xmlFreeURI(uri);
+
if ((obj2 != NULL) && (obj2->nodesetval != NULL) &&
(obj2->nodesetval->nodeNr > 0) &&
IS_XSLT_REAL_NODE(obj2->nodesetval->nodeTab[0])) {
@@ -313,7 +318,8 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
(xmlNodePtr) tctxt->style->doc);
}
}
- URI = xmlBuildURI(obj->stringval, base);
+
+ URI = xmlBuildURI(url, base);
if (base != NULL)
xmlFree(base);
if (URI == NULL) {
@@ -326,10 +332,14 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
}
} else {
- xsltDocumentFunctionLoadDocument( ctxt, URI );
+ xsltDocumentFunctionLoadDocument(ctxt, URI, fragment);
xmlFree(URI);
}
}
+
+error:
+ xmlFree(newURI);
+ xmlFree(fragment);
xmlXPathFreeObject(obj);
if (obj2 != NULL)
xmlXPathFreeObject(obj2);
diff --git a/libxslt/security.c b/libxslt/security.c
index 001ee6e4..3a66594f 100644
--- a/libxslt/security.c
+++ b/libxslt/security.c
@@ -422,6 +422,19 @@ xsltCheckRead(xsltSecurityPrefsPtr sec,
xmlURIPtr uri;
xsltSecurityCheck check;
+ if (xmlStrstr(URL, BAD_CAST "://") == NULL) {
+ check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_FILE);
+ if (check != NULL) {
+ ret = check(sec, ctxt, (const char *) URL);
+ if (ret == 0) {
+ xsltTransformError(ctxt, NULL, NULL,
+ "Local file read for %s refused\n", URL);
+ return(0);
+ }
+ }
+ return(1);
+ }
+
uri = xmlParseURI((const char *)URL);
if (uri == NULL) {
xsltTransformError(ctxt, NULL, NULL,
--
GitLab

View File

@ -5,7 +5,7 @@ EAPI=8
# Note: Please bump this in sync with dev-libs/libxml2. # Note: Please bump this in sync with dev-libs/libxml2.
PYTHON_COMPAT=( python3_{10..12} ) PYTHON_COMPAT=( python3_{10..13} )
inherit flag-o-matic python-r1 multilib-minimal inherit flag-o-matic python-r1 multilib-minimal
DESCRIPTION="XSLT libraries and tools" DESCRIPTION="XSLT libraries and tools"

View File

@ -0,0 +1,129 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# Note: Please bump this in sync with dev-libs/libxml2.
PYTHON_COMPAT=( python3_{10..13} )
inherit python-r1 multilib-minimal
DESCRIPTION="XSLT libraries and tools"
HOMEPAGE="https://gitlab.gnome.org/GNOME/libxslt"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://gitlab.gnome.org/GNOME/libxslt"
inherit autotools git-r3
else
inherit libtool gnome.org
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
fi
LICENSE="MIT"
SLOT="0"
IUSE="crypt debug examples python static-libs"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
BDEPEND=">=virtual/pkgconfig-1"
RDEPEND="
>=dev-libs/libxml2-2.13:2[${MULTILIB_USEDEP}]
crypt? ( >=dev-libs/libgcrypt-1.5.3:=[${MULTILIB_USEDEP}] )
python? (
${PYTHON_DEPS}
>=dev-libs/libxml2-2.13:2[${MULTILIB_USEDEP},python,${PYTHON_USEDEP}]
)
"
DEPEND="${RDEPEND}"
MULTILIB_CHOST_TOOLS=(
/usr/bin/xslt-config
)
MULTILIB_WRAPPED_HEADERS=(
/usr/include/libxslt/xsltconfig.h
)
PATCHES=(
"${FILESDIR}"/${P}-extensions-xmlCheckFilename-older-libxml2.patch
"${FILESDIR}"/${P}-libxml2-2.13.patch
"${FILESDIR}"/${P}-deprecated-xmlCharEncodingHandler.patch
)
src_prepare() {
default
if [[ ${PV} == 9999 ]] ; then
eautoreconf
else
# Prefix always needs elibtoolize if not eautoreconf'd.
elibtoolize
fi
}
multilib_src_configure() {
libxslt_configure() {
ECONF_SOURCE="${S}" econf \
--without-python \
$(use_with crypt crypto) \
$(use_with debug) \
$(use_enable static-libs static) \
"$@"
}
# Build Python bindings separately
libxslt_configure --without-python
if multilib_is_native_abi && use python ; then
NATIVE_BUILD_DIR="${BUILD_DIR}"
python_foreach_impl run_in_build_dir libxslt_configure --with-python
fi
}
libxslt_py_emake() {
pushd "${BUILD_DIR}"/python >/dev/null || die
emake top_builddir="${NATIVE_BUILD_DIR}" "$@"
popd >/dev/null || die
}
multilib_src_compile() {
default
if multilib_is_native_abi && use python ; then
python_foreach_impl run_in_build_dir libxslt_py_emake all
fi
}
multilib_src_test() {
default
if multilib_is_native_abi && use python ; then
python_foreach_impl run_in_build_dir libxslt_py_emake check
fi
}
multilib_src_install() {
# "default" does not work here - docs are installed by multilib_src_install_all
emake DESTDIR="${D}" install
if multilib_is_native_abi && use python; then
python_foreach_impl run_in_build_dir libxslt_py_emake \
DESTDIR="${D}" \
install
# Hack until automake release is made for the optimise fix
# https://git.savannah.gnu.org/cgit/automake.git/commit/?id=bde43d0481ff540418271ac37012a574a4fcf097
python_foreach_impl python_optimize
fi
}
multilib_src_install_all() {
einstalldocs
if ! use examples ; then
rm -rf "${ED}"/usr/share/doc/${PF}/tutorial{,2} || die
rm -rf "${ED}"/usr/share/doc/${PF}/python/examples || die
fi
find "${ED}" -type f -name "*.la" -delete || die
}

View File

@ -5,7 +5,7 @@ EAPI=8
# Note: Please bump this in sync with dev-libs/libxml2. # Note: Please bump this in sync with dev-libs/libxml2.
PYTHON_COMPAT=( python3_{10..12} ) PYTHON_COMPAT=( python3_{10..13} )
inherit python-r1 multilib-minimal inherit python-r1 multilib-minimal
DESCRIPTION="XSLT libraries and tools" DESCRIPTION="XSLT libraries and tools"
@ -25,9 +25,12 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
BDEPEND=">=virtual/pkgconfig-1" BDEPEND=">=virtual/pkgconfig-1"
RDEPEND=" RDEPEND="
>=dev-libs/libxml2-2.9.11:2[${MULTILIB_USEDEP}] >=dev-libs/libxml2-2.13:2[${MULTILIB_USEDEP}]
crypt? ( >=dev-libs/libgcrypt-1.5.3:0=[${MULTILIB_USEDEP}] ) crypt? ( >=dev-libs/libgcrypt-1.5.3:=[${MULTILIB_USEDEP}] )
python? ( ${PYTHON_DEPS} ) python? (
${PYTHON_DEPS}
>=dev-libs/libxml2-2.13:2[${MULTILIB_USEDEP},python,${PYTHON_USEDEP}]
)
" "
DEPEND="${RDEPEND}" DEPEND="${RDEPEND}"
@ -39,6 +42,12 @@ MULTILIB_WRAPPED_HEADERS=(
/usr/include/libxslt/xsltconfig.h /usr/include/libxslt/xsltconfig.h
) )
PATCHES=(
"${FILESDIR}"/${P}-extensions-xmlCheckFilename-older-libxml2.patch
"${FILESDIR}"/${P}-libxml2-2.13.patch
"${FILESDIR}"/${P}-deprecated-xmlCharEncodingHandler.patch
)
src_prepare() { src_prepare() {
default default