Accepting request 1238664 from devel:libraries:c_c++

OBS-URL: https://build.opensuse.org/request/show/1238664
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libxslt?expand=0&rev=71
This commit is contained in:
2025-01-20 16:14:09 +00:00
committed by Git OBS Bridge
7 changed files with 349 additions and 49 deletions

View File

@@ -1,27 +0,0 @@
From 02a57a01c603462ce8cc65fc64076a107ccf758e Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Fri, 1 Dec 2023 21:05:19 +0100
Subject: [PATCH] tests: Fix build with older libxml2
Fixes #99.
---
tests/runtest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/runtest.c b/tests/runtest.c
index ea08824..f61c66a 100644
--- a/tests/runtest.c
+++ b/tests/runtest.c
@@ -456,7 +456,8 @@ initializeLibxml2(void) {
xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader);
xmlSetGenericErrorFunc(NULL, testErrorHandler);
xsltSetGenericErrorFunc(NULL, testErrorHandler);
- xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler);
+ xmlSetStructuredErrorFunc(NULL,
+ (xmlStructuredErrorFunc) testStructuredErrorHandler);
exsltRegisterAll();
xsltRegisterTestModule();
xsltMaxDepth = 200;
--
2.45.1

View File

@@ -1,11 +0,0 @@
--- libxslt-1.1.39/tests/runtest.c.old 2023-11-16 12:36:28.000000000 +0000
+++ libxslt-1.1.39/tests/runtest.c 2024-05-05 16:25:22.656618600 +0000
@@ -269,7 +269,7 @@ xmlParserPrintFileContextInternal(xmlPar
}
static void
-testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, const xmlError *err) {
+testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, xmlError *err) {
char *file = NULL;
int line = 0;
int code = -1;

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2a20ad621148339b0759c4d4e96719362dee64c9a096dbba625ba053846349f0
size 1578216

3
libxslt-1.1.42.tar.xz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:85ca62cac0d41fc77d3f6033da9df6fd73d20ea2fc18b0a3609ffb4110e1baeb
size 1573668

View File

@@ -0,0 +1,275 @@
From bf59c338121b8b45d66ba6ecea69ad498015c396 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 12 Nov 2024 13:28:55 +0100
Subject: [PATCH] tests: Make runtest compile with older libxml2 versions
This partly reverts commit ce3ad4f93c7637a454ad7db501158110a0813f05.
Fixes #125.
---
tests/runtest.c | 244 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 244 insertions(+)
diff --git a/tests/runtest.c b/tests/runtest.c
index be6ccb0e..7360615d 100644
--- a/tests/runtest.c
+++ b/tests/runtest.c
@@ -190,11 +190,255 @@ testErrorHandler(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
testErrors[testErrorsSize] = 0;
}
+#if LIBXML_VERSION < 21300
+
+/**
+ * xmlParserPrintFileContext:
+ * @input: an xmlParserInputPtr input
+ *
+ * Displays current context within the input content for error tracking
+ */
+
+static void
+xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
+ xmlGenericErrorFunc chanl, void *data ) {
+ const xmlChar *cur, *base;
+ unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
+ xmlChar content[81]; /* space for 80 chars + line terminator */
+ xmlChar *ctnt;
+
+ if (input == NULL) return;
+ cur = input->cur;
+ base = input->base;
+ /* skip backwards over any end-of-lines */
+ while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) {
+ cur--;
+ }
+ n = 0;
+ /* search backwards for beginning-of-line (to max buff size) */
+ while ((n++ < (sizeof(content)-1)) && (cur > base) &&
+ (*(cur) != '\n') && (*(cur) != '\r'))
+ cur--;
+ if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
+ /* calculate the error position in terms of the current position */
+ col = input->cur - cur;
+ /* search forward for end-of-line (to max buff size) */
+ n = 0;
+ ctnt = content;
+ /* copy selected text to our buffer */
+ while ((*cur != 0) && (*(cur) != '\n') &&
+ (*(cur) != '\r') && (n < sizeof(content)-1)) {
+ *ctnt++ = *cur++;
+ n++;
+ }
+ *ctnt = 0;
+ /* print out the selected text */
+ chanl(data ,"%s\n", content);
+ /* create blank line with problem pointer */
+ n = 0;
+ ctnt = content;
+ /* (leave buffer space for pointer + line terminator) */
+ while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
+ if (*(ctnt) != '\t')
+ *(ctnt) = ' ';
+ ctnt++;
+ }
+ *ctnt++ = '^';
+ *ctnt = 0;
+ chanl(data ,"%s\n", content);
+}
+
+static void
+testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, const xmlError *err) {
+ char *file = NULL;
+ int line = 0;
+ int code = -1;
+ int domain;
+ void *data = NULL;
+ const char *str;
+ const xmlChar *name = NULL;
+ xmlNodePtr node;
+ xmlErrorLevel level;
+ xmlParserInputPtr input = NULL;
+ xmlParserInputPtr cur = NULL;
+ xmlParserCtxtPtr ctxt = NULL;
+
+ if (err == NULL)
+ return;
+
+ file = err->file;
+ line = err->line;
+ code = err->code;
+ domain = err->domain;
+ level = err->level;
+ node = err->node;
+ if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
+ (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
+ (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
+ ctxt = err->ctxt;
+ }
+ str = err->message;
+
+ if (code == XML_ERR_OK)
+ return;
+
+ if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
+ name = node->name;
+
+ /*
+ * Maintain the compatibility with the legacy error handling
+ */
+ if (ctxt != NULL) {
+ input = ctxt->input;
+ if ((input != NULL) && (input->filename == NULL) &&
+ (ctxt->inputNr > 1)) {
+ cur = input;
+ input = ctxt->inputTab[ctxt->inputNr - 2];
+ }
+ if (input != NULL) {
+ if (input->filename)
+ testErrorHandler(data, "%s:%d: ", input->filename, input->line);
+ else if ((line != 0) && (domain == XML_FROM_PARSER))
+ testErrorHandler(data, "Entity: line %d: ", input->line);
+ }
+ } else {
+ if (file != NULL)
+ testErrorHandler(data, "%s:%d: ", file, line);
+ else if ((line != 0) && (domain == XML_FROM_PARSER))
+ testErrorHandler(data, "Entity: line %d: ", line);
+ }
+ if (name != NULL) {
+ testErrorHandler(data, "element %s: ", name);
+ }
+ if (code == XML_ERR_OK)
+ return;
+ switch (domain) {
+ case XML_FROM_PARSER:
+ testErrorHandler(data, "parser ");
+ break;
+ case XML_FROM_NAMESPACE:
+ testErrorHandler(data, "namespace ");
+ break;
+ case XML_FROM_DTD:
+ case XML_FROM_VALID:
+ testErrorHandler(data, "validity ");
+ break;
+ case XML_FROM_HTML:
+ testErrorHandler(data, "HTML parser ");
+ break;
+ case XML_FROM_MEMORY:
+ testErrorHandler(data, "memory ");
+ break;
+ case XML_FROM_OUTPUT:
+ testErrorHandler(data, "output ");
+ break;
+ case XML_FROM_IO:
+ testErrorHandler(data, "I/O ");
+ break;
+ case XML_FROM_XINCLUDE:
+ testErrorHandler(data, "XInclude ");
+ break;
+ case XML_FROM_XPATH:
+ testErrorHandler(data, "XPath ");
+ break;
+ case XML_FROM_XPOINTER:
+ testErrorHandler(data, "parser ");
+ break;
+ case XML_FROM_REGEXP:
+ testErrorHandler(data, "regexp ");
+ break;
+ case XML_FROM_MODULE:
+ testErrorHandler(data, "module ");
+ break;
+ case XML_FROM_SCHEMASV:
+ testErrorHandler(data, "Schemas validity ");
+ break;
+ case XML_FROM_SCHEMASP:
+ testErrorHandler(data, "Schemas parser ");
+ break;
+ case XML_FROM_RELAXNGP:
+ testErrorHandler(data, "Relax-NG parser ");
+ break;
+ case XML_FROM_RELAXNGV:
+ testErrorHandler(data, "Relax-NG validity ");
+ break;
+ case XML_FROM_CATALOG:
+ testErrorHandler(data, "Catalog ");
+ break;
+ case XML_FROM_C14N:
+ testErrorHandler(data, "C14N ");
+ break;
+ case XML_FROM_XSLT:
+ testErrorHandler(data, "XSLT ");
+ break;
+ default:
+ break;
+ }
+ if (code == XML_ERR_OK)
+ return;
+ switch (level) {
+ case XML_ERR_NONE:
+ testErrorHandler(data, ": ");
+ break;
+ case XML_ERR_WARNING:
+ testErrorHandler(data, "warning : ");
+ break;
+ case XML_ERR_ERROR:
+ testErrorHandler(data, "error : ");
+ break;
+ case XML_ERR_FATAL:
+ testErrorHandler(data, "error : ");
+ break;
+ }
+ if (code == XML_ERR_OK)
+ return;
+ if (str != NULL) {
+ int len;
+ len = xmlStrlen((const xmlChar *)str);
+ if ((len > 0) && (str[len - 1] != '\n'))
+ testErrorHandler(data, "%s\n", str);
+ else
+ testErrorHandler(data, "%s", str);
+ } else {
+ testErrorHandler(data, "%s\n", "out of memory error");
+ }
+ if (code == XML_ERR_OK)
+ return;
+
+ if (ctxt != NULL) {
+ xmlParserPrintFileContextInternal(input, testErrorHandler, data);
+ if (cur != NULL) {
+ if (cur->filename)
+ testErrorHandler(data, "%s:%d: \n", cur->filename, cur->line);
+ else if ((line != 0) && (domain == XML_FROM_PARSER))
+ testErrorHandler(data, "Entity: line %d: \n", cur->line);
+ xmlParserPrintFileContextInternal(cur, testErrorHandler, data);
+ }
+ }
+ if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) &&
+ (err->int1 < 100) &&
+ (err->int1 < xmlStrlen((const xmlChar *)err->str1))) {
+ xmlChar buf[150];
+ int i;
+
+ testErrorHandler(data, "%s\n", err->str1);
+ for (i=0;i < err->int1;i++)
+ buf[i] = ' ';
+ buf[i++] = '^';
+ buf[i] = 0;
+ testErrorHandler(data, "%s\n", buf);
+ }
+}
+
+#else /* LIBXML_VERSION */
+
static void
testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, const xmlError *err) {
xmlFormatError(err, testErrorHandler, NULL);
}
+#endif /* LIBXML_VERSION */
+
static void
initializeLibxml2(void) {
xmlInitParser();
--
GitLab

View File

@@ -1,3 +1,67 @@
-------------------------------------------------------------------
Sat Jan 18 10:20:18 UTC 2025 - Pedro Monreal <pmonreal@suse.com>
- Remove the test_bad regression test that fails with old libxml2
as suggested by upstream devs:
* https://gitlab.gnome.org/GNOME/libxslt/-/issues/126
-------------------------------------------------------------------
Sat Jan 18 10:00:30 UTC 2025 - Pedro Monreal <pmonreal@suse.com>
- Allow building with older libxml2 versions:
* tests: Make runtest compile with older libxml2 versions
* https://gitlab.gnome.org/GNOME/libxslt/issues/125
* Add libxslt-test-compile-with-older-libxml2-versions.patch
-------------------------------------------------------------------
Fri Jan 17 15:53:19 UTC 2025 - Pedro Monreal <pmonreal@suse.com>
- Update to 1.1.42:
* Regressions:
- extensions: Readd call to xmlCheckFilename with older libxml2
* Improvments:
- utils: Don't use deprecated xmlCharEncodingHandler member
- transform: Handle filesystem paths after libxml2 changes
- locale: Work around issue with FreeBSD's strxfrm_l
* Build systems:
- cmake: Add LIBXSLT_WITH_PROGRAMS option (Don Olmstead)
- cmake: Fix HAVE_GCRYPT check
- Update to 1.1.41:
* Removals:
- autotools: Stop installing libxslt.m4
- autotools: Remove RPM build
* Improvements:
- libxslt: Set _FILE_OFFSET_BITS to 64
- xsltproc: Remove unneeded includes
- include: Don't define ATTRIBUTE_UNUSED in public header
- xsltproc: Make "-" read from stdin
* Build systems:
- cmake: Adjust paths for UNIX or UNIX-like target systems (Daniel E)
* Tests:
- cmake: Link testplugin with libxml2
- tests: Link testplugin with libxml2
- tests: Fix expected error after libxml2 change
- runtest: Switch to xmlFormatError
- fuzz: Avoid accessing internal struct members
- Update to 1.1.40:
* Removals:
- xsltproc: remove maxparserdepth option (Mike Dalessio)
* Improvements:
- functions: xmlXPtrNewContext is deprecated
- xsltproc: Stop calling xmlMemoryDump
- xsltproc: Prefer XML_PARSE_NONET over xmlNoNetEntityLoader
- functions: Fix build if libxml2 modules are disabled
- extensions: Don't call deprecated xmlCheckFilename
- documents: Don't set ctxt->directory
- exslt: Fix EXSLT functions without parameters
* Build systems:
- build: Remove mem-debug option
* Remove patches upstream:
- gcc14-runtest-no-const.patch
- 0001-tests-Fix-build-with-older-libxml2.patch
-------------------------------------------------------------------
Fri Sep 20 14:27:35 UTC 2024 - Bernhard Wiedemann <bwiedemann@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package libxslt
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
%define libexver 0
Name: libxslt
Version: 1.1.39
Version: 1.1.42
Release: 0
Summary: XSL Transformation Library
License: GPL-2.0-or-later AND MIT
@@ -40,11 +40,10 @@ Patch0: libxslt-1.1.24-no-net-autobuild.patch
# Initialize the random seed to ensure libxslt's math.random() function
# produces unpredictable outputs.
Patch1: libxslt-random-seed.patch
# PATCH-FIX_UPSTREAM -- gcc14-runtest-no-const.patch
Patch2: gcc14-runtest-no-const.patch
# PATCH-FIX-UPSTREAM -- 0001-tests-Fix-build-with-older-libxml2.patch
Patch3: 0001-tests-Fix-build-with-older-libxml2.patch
Patch4: libxslt-reproducible.patch
Patch2: libxslt-reproducible.patch
# PATCH-FIX-UPSTREAM -- libxslt-test-compile-with-older-libxml2-versions.patch
# https://gitlab.gnome.org/GNOME/libxslt/-/issues/125
Patch3: libxslt-test-compile-with-older-libxml2-versions.patch
#
### SUSE patches starts on 1000
# PATCH-FIX-SUSE
@@ -133,6 +132,7 @@ xtend the
%make_build
%check
find -type f -name "test_bad*" -delete -print
%make_build check
%install
@@ -176,7 +176,6 @@ find %{buildroot} -type f -name "*.la" -delete -print
%{_libdir}/cmake/libxslt/FindGcrypt.cmake
%{_libdir}/cmake/libxslt/libxslt-config.cmake
%{_includedir}/*
%{_datadir}/aclocal/*
%{_bindir}/xslt-config
%{_mandir}/man1/xslt-config.1%{?ext_man}
%{_mandir}/man3/*