rebuilt back with autotools to fix wrong library SOVER [release 1.1.35-2mamba;Sun Jun 05 2022]

This commit is contained in:
Silvan Calarco 2024-01-06 06:14:34 +01:00
parent 5116caaf69
commit c7b3e50f4f
2 changed files with 223 additions and 20 deletions

View File

@ -0,0 +1,181 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Veillard <veillard@redhat.com>
Date: Sun, 29 Oct 2017 01:04:54 +0200
Subject: [PATCH] Make generate-id deterministic
Origin: upstream, https://bugzilla.gnome.org/attachment.cgi?id=306475
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=751621
Bug-Debian: https://bugs.debian.org/823857
---
libxslt/functions.c | 91 ++++++++++++++++++++++++++++++++++++++++-
libxslt/functions.h | 7 ++++
libxslt/transform.c | 8 ++++
libxslt/xsltInternals.h | 2 +
4 files changed, 107 insertions(+), 1 deletion(-)
diff --git a/libxslt/functions.c b/libxslt/functions.c
index 7887dda70f67..be0d897bd471 100644
--- a/libxslt/functions.c
+++ b/libxslt/functions.c
@@ -683,6 +683,63 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
xmlXPathFreeObject(decimalObj);
}
+/**
+ * xsltCleanupIds:
+ * @ctxt: the transformation context
+ * @root: the root of the resulting document
+ *
+ * This clean up ids which may have been saved in Element contents
+ * by xsltGenerateIdFunction() to provide stable IDs on elements.
+ *
+ * Returns the number of items cleaned or -1 in case of error
+ */
+int
+xsltCleanupIds(xsltTransformContextPtr ctxt, xmlNodePtr root) {
+ xmlNodePtr cur;
+ int count = 0;
+
+ if ((ctxt == NULL) || (root == NULL))
+ return(-1);
+ if (root->type != XML_ELEMENT_NODE)
+ return(-1);
+
+ cur = root;
+ while (cur != NULL) {
+ if (cur->type == XML_ELEMENT_NODE) {
+ if (cur->content != NULL) {
+ cur->content = NULL;
+ count++;
+ }
+ if (cur->children != NULL) {
+ cur = cur->children;
+ continue;
+ }
+ }
+ if (cur->next != NULL) {
+ cur = cur->next;
+ continue;
+ }
+ do {
+ cur = cur->parent;
+ if (cur == NULL)
+ break;
+ if (cur == (xmlNodePtr) root) {
+ cur = NULL;
+ break;
+ }
+ if (cur->next != NULL) {
+ cur = cur->next;
+ break;
+ }
+ } while (cur != NULL);
+ }
+
+fprintf(stderr, "Attributed %d IDs for element, cleaned up %d\n",
+ ctxt->nextid, count);
+
+ return(count);
+}
+
/**
* xsltGenerateIdFunction:
* @ctxt: the XPath Parser context
@@ -734,7 +791,39 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
if (obj)
xmlXPathFreeObject(obj);
- val = (long)((char *)cur - (char *)&base_address);
+ /*
+ * Try to provide stable ID for generated document:
+ * - usually ID are computed to be placed on elements via attributes
+ * so using the element as the node for the ID
+ * - the cur->content should be a correct placeholder for this, we use
+ * it to hold element node numbers in xmlXPathOrderDocElems to
+ * speed up XPath too
+ * - xsltCleanupIds() clean them up before handing the XSLT output
+ * to the API client.
+ * - other nodes types use the node address method but that should
+ * not end up in resulting document ID
+ * - we can enable this by default without risk of performance issues
+ * only the one pass xsltCleanupIds() is added
+ */
+ if (cur->type == XML_ELEMENT_NODE) {
+ if (cur->content == NULL) {
+ xsltTransformContextPtr tctxt;
+
+ tctxt = xsltXPathGetTransformContext(ctxt);
+ if (tctxt == NULL) {
+ val = (long)((char *)cur - (char *)&base_address);
+ } else {
+ tctxt->nextid++;
+ val = tctxt->nextid;
+ cur->content = (void *) (val);
+ }
+ } else {
+ val = (long) cur->content;
+ }
+ } else {
+ val = (long)((char *)cur - (char *)&base_address);
+ }
+
if (val >= 0) {
snprintf((char *)str, sizeof(str), "idp%ld", val);
} else {
diff --git a/libxslt/functions.h b/libxslt/functions.h
index 5455b7f47802..31163613f6e9 100644
--- a/libxslt/functions.h
+++ b/libxslt/functions.h
@@ -63,6 +63,13 @@ XSLTPUBFUN void XSLTCALL
xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt,
int nargs);
+/*
+ * Cleanup for ID generation
+ */
+XSLTPUBFUN int XSLTCALL
+ xsltCleanupIds (xsltTransformContextPtr ctxt,
+ xmlNodePtr root);
+
/*
* And the registration
*/
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 57f05bf71920..9368e17197bf 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -706,6 +706,7 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) {
cur->traceCode = (unsigned long*) &xsltDefaultTrace;
cur->xinclude = xsltGetXIncludeDefault();
cur->keyInitLevel = 0;
+ cur->nextid = 0;
return(cur);
@@ -6038,6 +6039,13 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
if (root != NULL) {
const xmlChar *doctype = NULL;
+ /*
+ * cleanup ids which may have been saved in Elements content ptrs
+ */
+ if (ctxt->nextid != 0) {
+ xsltCleanupIds(ctxt, root);
+ }
+
if ((root->ns != NULL) && (root->ns->prefix != NULL))
doctype = xmlDictQLookup(ctxt->dict, root->ns->prefix, root->name);
if (doctype == NULL)
diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
index 14343d2751c8..9d3ff5fc0c06 100644
--- a/libxslt/xsltInternals.h
+++ b/libxslt/xsltInternals.h
@@ -1786,6 +1786,8 @@ struct _xsltTransformContext {
int maxTemplateVars;
unsigned long opLimit;
unsigned long opCount;
+
+ unsigned long nextid;/* for generating stable ids */
};
/**

View File

@ -2,22 +2,24 @@
%define libname libxslt %define libname libxslt
Name: libxslt Name: libxslt
Version: 1.1.34 Version: 1.1.35
Release: 3mamba Release: 2mamba
Summary: Library providing the Gnome XSLT engine Summary: Library providing the Gnome XSLT engine
Group: System/Libraries Group: System/Libraries
Vendor: openmamba Vendor: openmamba
Distribution: openmamba Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it> Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.xmlsoft.org/XSLT/ URL: https://gitlab.gnome.org/GNOME/libxslt/
Source: ftp://xmlsoft.org/libxslt/libxslt-%{version}.tar.gz Source: https://gitlab.gnome.org/GNOME/libxslt.git/v%{version}/libxslt-%{version}.tar.bz2
Patch0: libxslt-1.1.34-man-pages-stylesheet-fix.patch Patch0: libxslt-1.1.34-man-pages-stylesheet-fix.patch
Patch1: libxslt-1.1.35-Make-generate-id-deterministic.patch
License: MIT License: MIT
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel BuildRequires: glibc-devel
BuildRequires: libgcrypt-devel BuildRequires: libgcrypt-devel
BuildRequires: libgpg-error-devel BuildRequires: libgpg-error-devel
BuildRequires: liblzma-devel BuildRequires: liblzma-devel
BuildRequires: libpython310-devel
BuildRequires: libxml2-devel BuildRequires: libxml2-devel
BuildRequires: libz-devel BuildRequires: libz-devel
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
@ -56,24 +58,29 @@ Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description -n python-xslt %description -n python-xslt
This C library allows to transform XML files into other XML files (or HTML, text, ...) using the standard XSLT stylesheet transformation mechanism. This C library allows to transform XML files into other XML files (or HTML, text, ...) using the standard XSLT stylesheet transformation mechanism.
This package contains the bindings to use the librarywith Python programs. This package contains the bindings to use the librarywith Python programs.
%debug_package %debug_package
%prep %prep
%setup -q %setup -q
%patch0 -p1 #%patch0 -p1
%patch1 -p1 -b .Make-generate-id-deterministic
NOCONFIGURE=1 ./autogen.sh
%build %build
# NOTE: as of 1.1.35 cmake build messes with library SOVER
#% cmake -d build
%configure \ %configure \
--without-python --disable-static
%make %make
%install %install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeoldinstall %makeinstall
%clean %clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
@ -85,6 +92,7 @@ This package contains the bindings to use the librarywith Python programs.
%defattr(-,root,root) %defattr(-,root,root)
%{_libdir}/libexslt.so.* %{_libdir}/libexslt.so.*
%{_libdir}/libxslt.so.* %{_libdir}/libxslt.so.*
%doc AUTHORS Copyright
%files tools %files tools
%defattr(-,root,root) %defattr(-,root,root)
@ -98,23 +106,37 @@ This package contains the bindings to use the librarywith Python programs.
%{_includedir}/libxslt/*.h %{_includedir}/libxslt/*.h
%dir %{_includedir}/libexslt %dir %{_includedir}/libexslt
%{_includedir}/libexslt/*.h %{_includedir}/libexslt/*.h
%{_libdir}/*.a %{_datadir}/aclocal/libxslt.m4
%{_libdir}/*.la %{_libdir}/libexslt.la
%{_libdir}/*.so %{_libdir}/libxslt.la
%{_libdir}/libexslt.so
%{_libdir}/libxslt.so
%{_libdir}/xsltConf.sh %{_libdir}/xsltConf.sh
%{_libdir}/pkgconfig/* %{_libdir}/pkgconfig/libexslt.pc
%{_datadir}/aclocal/* %{_libdir}/pkgconfig/libxslt.pc
%dir %{_datadir}/doc/libxslt-%{version} %dir %{_libdir}/cmake/libxslt
%{_datadir}/doc/libxslt-%{version}/html/* %{_libdir}/cmake/libxslt/*.cmake
%dir %{_docdir}/libxslt-%{version}
%{_docdir}/libxslt-%{version}/*
%dir %{_datadir}/gtk-doc/html/libxslt
%{_datadir}/gtk-doc/html/libxslt/*
%dir %{_datadir}/gtk-doc/html/libexslt
%{_datadir}/gtk-doc/html/libexslt/*
%{_mandir}/man3/* %{_mandir}/man3/*
#%files -n python-xslt %files -n python-xslt
#%defattr(-,root,root) %defattr(-,root,root)
#%dir %{_datadir}/doc/libxslt-python-%{version} %dir %{_datadir}/doc/libxslt-python-%{version}
#%{_datadir}/doc/libxslt-python-%{version}/* %{_datadir}/doc/libxslt-python-%{version}/*
#%{python_sitearch}/* %{python310_sitearch}/*
%changelog %changelog
* Sun Jun 05 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.35-2mamba
- rebuilt back with autotools to fix wrong library SOVER
* Sat May 28 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.35-1mamba
- update to 1.1.35
* Sat May 15 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.34-3mamba * Sat May 15 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.34-3mamba
- patched to fix man page stylesheet - patched to fix man page stylesheet