Use non-recursive string.subst

The patch comes from Debian:
https://anonscm.debian.org/cgit/collab-maint/docbook-xsl.git/tree/debian/patches/765567_non-recursive_string_subst.patch
This commit is contained in:
Alexander Bokovoy 2017-09-13 16:25:32 +03:00
parent a2b668555e
commit bf9e5d16fd
2 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,30 @@
Description: use EXSLT "replace" function when available
A recursive implementation of string.subst is problematic,
long strings with many matches will cause stack overflows.
Author: Peter De Wachter <pdewacht@gmail.com>
Bug-Debian: https://bugs.debian.org/750593
--- docbook-xsl-1.78.1+dfsg.orig/docbook-xsl/lib/lib.xsl
+++ docbook-xsl-1.78.1+dfsg/docbook-xsl/lib/lib.xsl
@@ -10,7 +10,10 @@
This module implements DTD-independent functions
******************************************************************** -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:str="http://exslt.org/strings"
+ exclude-result-prefixes="str"
+ version="1.0">
<xsl:template name="dot.count">
<!-- Returns the number of "." characters in a string -->
@@ -56,6 +59,9 @@
<xsl:param name="replacement"/>
<xsl:choose>
+ <xsl:when test="function-available('str:replace')">
+ <xsl:value-of select="str:replace($string, string($target), string($replacement))"/>
+ </xsl:when>
<xsl:when test="contains($string, $target)">
<xsl:variable name="rest">
<xsl:call-template name="string.subst">

View File

@ -1,6 +1,6 @@
Name: docbook-style-xsl
Version: 1.79.2
Release: 5%{?dist}
Release: 6%{?dist}
Group: Applications/Text
Summary: Norman Walsh's XSL stylesheets for DocBook XML
@ -38,7 +38,8 @@ Patch4: docbook-xsl-non-constant-expressions.patch
Patch5: docbook-xsl-list-item-body.patch
#workaround missing mandir section problem (#727251)
Patch6: docbook-xsl-mandir.patch
#Non-recursive string.subst that doesn't kill smb.conf.5 generation
Patch7: docbook-style-xsl-non-recursive-string-subst.patch
%description
These XSL stylesheets allow you to transform any DocBook XML document to
@ -58,6 +59,7 @@ popd
%patch4 -p1 -b .nonconstant
%patch5 -p1 -b .listitembody
%patch6 -p1 -b .mandir
%patch7 -p2 -b .non-recursive-subst
cp -p %{SOURCE1} Makefile
@ -137,6 +139,9 @@ if [ "$1" = 0 ]; then
fi
%changelog
* Wed Sep 13 2017 Alexander Bokovoy <abokovoy@redhat.com> - 1.79.2-6
- Use non-recursive string.subst to allow building large documents like smb.conf.5
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.79.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild