From 5b8ea19a9e984c59d363125c96dd19c6514b6498 Mon Sep 17 00:00:00 2001 From: Lubos Uhliarik Date: Fri, 23 Apr 2021 15:02:41 +0000 Subject: [PATCH] new version 5.0.5 Resolves: #1952896 - Rebase squid to >= 5.0.5 Resolves: #1940412 - Remove libdb dependency from squid --- sources | 4 +- squid-4.0.21-large-acl.patch | 178 ----------------------------- squid-5.0.5-build-errors.patch | 116 +++++++++++++++++++ squid-5.0.5-symlink-lang-err.patch | 80 +++++++++++++ squid-gcc11.patch | 24 ---- squid.spec | 66 +++++++++-- 6 files changed, 254 insertions(+), 214 deletions(-) delete mode 100644 squid-4.0.21-large-acl.patch create mode 100644 squid-5.0.5-build-errors.patch create mode 100644 squid-5.0.5-symlink-lang-err.patch delete mode 100644 squid-gcc11.patch diff --git a/sources b/sources index 44e9f71..cf080d9 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (squid-4.14.tar.xz) = 3509caea9e10ea54547eeb769a21f0ca4d37e39a063953821fc51d588b22facfa183d0a48be9ab15831ee646e031079b515c75162515b8a4e7c708df2d41958b -SHA512 (squid-4.14.tar.xz.asc) = a556e5f20e25e598375e3a6d8a300a1e35b29c89b8125f31d3fb16f1f59f538548f7f2e7424f06fc957e330cca8f16e0efe534a4772699454cd1778a82d4647d +SHA512 (squid-5.0.5.tar.xz) = e0f816296d9d32fc97b98249dde077b321651dac70c212fe8eb9566003ce04f13a83665e387531e06bffbab1ec21277e3e0549a16caee426b6a749e18bf77991 +SHA512 (squid-5.0.5.tar.xz.asc) = ca1b170bef9cca5afe1108e8a439282f3a19bea48d2dba42847acd1cf039d38ccc8c714e27fc9e49fe9e3027963f64e9ab19e6a358e6e038c78f85cc77657a3b SHA512 (pgp.asc) = 09f7012030d68831dfc083d67ca63ee54ed851482ca8d0e9505b444ee3e7ddeed62369b53f2917c9b2e0e57cc0533fce46e8cafd2ebcd1c6cb186b516efd0ad2 diff --git a/squid-4.0.21-large-acl.patch b/squid-4.0.21-large-acl.patch deleted file mode 100644 index 8aacf38..0000000 --- a/squid-4.0.21-large-acl.patch +++ /dev/null @@ -1,178 +0,0 @@ -diff --git a/src/acl/RegexData.cc b/src/acl/RegexData.cc -index 01a4c12..b5c1679 100644 ---- a/src/acl/RegexData.cc -+++ b/src/acl/RegexData.cc -@@ -22,6 +22,7 @@ - #include "ConfigParser.h" - #include "Debug.h" - #include "sbuf/List.h" -+#include "sbuf/Algorithms.h" - - ACLRegexData::~ACLRegexData() - { -@@ -129,6 +130,18 @@ compileRE(std::list &curlist, const char * RE, int flags) - return true; - } - -+static bool -+compileRE(std::list &curlist, const SBufList &RE, int flags) -+{ -+ if (RE.empty()) -+ return curlist.empty(); // XXX: old code did this. It looks wrong. -+ SBuf regexp; -+ static const SBuf openparen("("), closeparen(")"), separator(")|("); -+ JoinContainerIntoSBuf(regexp, RE.begin(), RE.end(), separator, openparen, -+ closeparen); -+ return compileRE(curlist, regexp.c_str(), flags); -+} -+ - /** Compose and compile one large RE from a set of (small) REs. - * The ultimate goal is to have only one RE per ACL so that match() is - * called only once per ACL. -@@ -137,16 +150,11 @@ static int - compileOptimisedREs(std::list &curlist, const SBufList &sl) - { - std::list newlist; -- int numREs = 0; -+ SBufList accumulatedRE; -+ int numREs = 0, reSize = 0; - int flags = REG_EXTENDED | REG_NOSUB; -- int largeREindex = 0; -- char largeRE[BUFSIZ]; -- *largeRE = 0; - - for (const SBuf & configurationLineWord : sl) { -- int RElen; -- RElen = configurationLineWord.length(); -- - static const SBuf minus_i("-i"); - static const SBuf plus_i("+i"); - if (configurationLineWord == minus_i) { -@@ -155,10 +163,11 @@ compileOptimisedREs(std::list &curlist, const SBufList &sl) - debugs(28, 2, "optimisation of -i ... -i" ); - } else { - debugs(28, 2, "-i" ); -- if (!compileRE(newlist, largeRE, flags)) -+ if (!compileRE(newlist, accumulatedRE, flags)) - return 0; - flags |= REG_ICASE; -- largeRE[largeREindex=0] = '\0'; -+ accumulatedRE.clear(); -+ reSize = 0; - } - } else if (configurationLineWord == plus_i) { - if ((flags & REG_ICASE) == 0) { -@@ -166,37 +175,34 @@ compileOptimisedREs(std::list &curlist, const SBufList &sl) - debugs(28, 2, "optimisation of +i ... +i"); - } else { - debugs(28, 2, "+i"); -- if (!compileRE(newlist, largeRE, flags)) -+ if (!compileRE(newlist, accumulatedRE, flags)) - return 0; - flags &= ~REG_ICASE; -- largeRE[largeREindex=0] = '\0'; -+ accumulatedRE.clear(); -+ reSize = 0; - } -- } else if (RElen + largeREindex + 3 < BUFSIZ-1) { -+ } else if (reSize < 1024) { - debugs(28, 2, "adding RE '" << configurationLineWord << "'"); -- if (largeREindex > 0) { -- largeRE[largeREindex] = '|'; -- ++largeREindex; -- } -- largeRE[largeREindex] = '('; -- ++largeREindex; -- configurationLineWord.copy(largeRE+largeREindex, BUFSIZ-largeREindex); -- largeREindex += configurationLineWord.length(); -- largeRE[largeREindex] = ')'; -- ++largeREindex; -- largeRE[largeREindex] = '\0'; -+ accumulatedRE.push_back(configurationLineWord); - ++numREs; -+ reSize += configurationLineWord.length(); - } else { - debugs(28, 2, "buffer full, generating new optimised RE..." ); -- if (!compileRE(newlist, largeRE, flags)) -+ accumulatedRE.push_back(configurationLineWord); -+ if (!compileRE(newlist, accumulatedRE, flags)) - return 0; -- largeRE[largeREindex=0] = '\0'; -+ accumulatedRE.clear(); -+ reSize = 0; - continue; /* do the loop again to add the RE to largeRE */ - } - } - -- if (!compileRE(newlist, largeRE, flags)) -+ if (!compileRE(newlist, accumulatedRE, flags)) - return 0; - -+ accumulatedRE.clear(); -+ reSize = 0; -+ - /* all was successful, so put the new list at the tail */ - curlist.splice(curlist.end(), newlist); - -diff --git a/src/sbuf/Algorithms.h b/src/sbuf/Algorithms.h -index 21ee889..338e9c0 100644 ---- a/src/sbuf/Algorithms.h -+++ b/src/sbuf/Algorithms.h -@@ -81,6 +81,57 @@ SBufContainerJoin(const Container &items, const SBuf& separator) - return rv; - } - -+/** Join container of SBufs and append to supplied target -+ * -+ * append to the target SBuf all elements in the [begin,end) range from -+ * an iterable container, prefixed by prefix, separated by separator and -+ * followed by suffix. Prefix and suffix are added also in case of empty -+ * iterable -+ * -+ * \return the modified dest -+ */ -+template -+SBuf& -+JoinContainerIntoSBuf(SBuf &dest, const ContainerIterator &begin, -+ const ContainerIterator &end, const SBuf& separator, -+ const SBuf& prefix = SBuf(), const SBuf& suffix = SBuf()) -+{ -+ if (begin == end) { -+ dest.append(prefix).append(suffix); -+ return dest; -+ } -+ -+ // optimization: pre-calculate needed storage -+ const SBuf::size_type totalContainerSize = -+ std::accumulate(begin, end, 0, SBufAddLength(separator)) + -+ dest.length() + prefix.length() + suffix.length(); -+ SBufReservationRequirements req; -+ req.minSpace = totalContainerSize; -+ dest.reserve(req); -+ -+ auto i = begin; -+ dest.append(prefix); -+ dest.append(*i); -+ ++i; -+ for (; i != end; ++i) -+ dest.append(separator).append(*i); -+ dest.append(suffix); -+ return dest; -+} -+ -+ -+/// convenience wrapper of JoinContainerIntoSBuf with no caller-supplied SBuf -+template -+SBuf -+JoinContainerToSBuf(const ContainerIterator &begin, -+ const ContainerIterator &end, const SBuf& separator, -+ const SBuf& prefix = SBuf(), const SBuf& suffix = SBuf()) -+{ -+ SBuf rv; -+ return JoinContainerIntoSBuf(rv, begin, end, separator, prefix, suffix); -+} -+ -+ - namespace std { - /// default hash functor to support std::unordered_map - template <> diff --git a/squid-5.0.5-build-errors.patch b/squid-5.0.5-build-errors.patch new file mode 100644 index 0000000..4293d67 --- /dev/null +++ b/squid-5.0.5-build-errors.patch @@ -0,0 +1,116 @@ +diff --git a/src/Makefile.am b/src/Makefile.am +index 81403a7..5e2a493 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -2477,6 +2477,7 @@ tests_testHttpRequest_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + tests_testHttpRequest_LDFLAGS = $(LIBADD_DL) +@@ -2781,6 +2782,7 @@ tests_testCacheManager_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + tests_testCacheManager_LDFLAGS = $(LIBADD_DL) +@@ -3101,6 +3103,7 @@ tests_testEvent_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + tests_testEvent_LDFLAGS = $(LIBADD_DL) +@@ -3339,6 +3342,7 @@ tests_testEventLoop_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + tests_testEventLoop_LDFLAGS = $(LIBADD_DL) +diff --git a/src/Makefile.in b/src/Makefile.in +index fda6de6..4e047cc 100644 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -4581,6 +4581,7 @@ tests_test_http_range_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + +@@ -4972,6 +4973,7 @@ tests_testHttpRequest_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + +@@ -5274,6 +5276,7 @@ tests_testCacheManager_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + +@@ -5593,6 +5596,7 @@ tests_testEvent_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + +@@ -5832,6 +5836,7 @@ tests_testEventLoop_LDADD = \ + $(SSLLIB) \ + $(KRB5LIBS) \ + $(LIBCPPUNIT_LIBS) \ ++ $(SYSTEMD_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + +diff --git a/src/proxyp/Parser.cc b/src/proxyp/Parser.cc +index 328d207..2f358a7 100644 +--- a/src/proxyp/Parser.cc ++++ b/src/proxyp/Parser.cc +@@ -15,6 +15,7 @@ + #include "sbuf/Stream.h" + + #include ++#include + + #if HAVE_SYS_SOCKET_H + #include +diff --git a/src/security/ServerOptions.cc b/src/security/ServerOptions.cc +index e114ed8..22bce84 100644 +--- a/src/security/ServerOptions.cc ++++ b/src/security/ServerOptions.cc +@@ -18,6 +18,7 @@ + #if USE_OPENSSL + #include "compat/openssl.h" + #include "ssl/support.h" ++#include + + #if HAVE_OPENSSL_ERR_H + #include +diff --git a/src/acl/ConnMark.cc b/src/acl/ConnMark.cc +index 1fdae0c..213cf39 100644 +--- a/src/acl/ConnMark.cc ++++ b/src/acl/ConnMark.cc +@@ -15,6 +15,7 @@ + #include "Debug.h" + #include "http/Stream.h" + #include "sbuf/Stream.h" ++#include + + bool + Acl::ConnMark::empty() const diff --git a/squid-5.0.5-symlink-lang-err.patch b/squid-5.0.5-symlink-lang-err.patch new file mode 100644 index 0000000..29b5e2c --- /dev/null +++ b/squid-5.0.5-symlink-lang-err.patch @@ -0,0 +1,80 @@ +From fc01451000eaa5592cd5afbd6aee14e53f7dd2c3 Mon Sep 17 00:00:00 2001 +From: Amos Jeffries +Date: Sun, 18 Oct 2020 20:23:10 +1300 +Subject: [PATCH] Update translations integration + +* Add credits for es-mx translation moderator +* Use es-mx for default of all Spanish (Central America) texts +* Update translation related .am files +--- + doc/manuals/language.am | 2 +- + errors/TRANSLATORS | 1 + + errors/aliases | 3 ++- + errors/language.am | 3 ++- + errors/template.am | 2 +- + 5 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/doc/manuals/language.am b/doc/manuals/language.am +index 7670c88380c..f03c4cf71b4 100644 +--- a/doc/manuals/language.am ++++ b/doc/manuals/language.am +@@ -18,4 +18,4 @@ TRANSLATE_LANGUAGES = \ + oc.lang \ + pt.lang \ + ro.lang \ +- ru.lang ++ ru.lang +diff --git a/errors/TRANSLATORS b/errors/TRANSLATORS +index e29bf707678..6ee2df637ad 100644 +--- a/errors/TRANSLATORS ++++ b/errors/TRANSLATORS +@@ -21,6 +21,7 @@ and ideas to make Squid available as multi-langual software. + George Machitidze + Henrik Nordström + Ivan Masár ++ Javier Pacheco + John 'Profic' Ustiuzhanin + Leandro Cesar Nardini Frasson + liuyongbing +diff --git a/errors/aliases b/errors/aliases +index 36f17f4b80f..cf0116f297d 100644 +--- a/errors/aliases ++++ b/errors/aliases +@@ -14,7 +14,8 @@ da da-dk + de de-at de-ch de-de de-li de-lu + el el-gr + en en-au en-bz en-ca en-cn en-gb en-ie en-in en-jm en-nz en-ph en-sg en-tt en-uk en-us en-za en-zw +-es es-ar es-bo es-cl es-co es-cr es-do es-ec es-es es-gt es-hn es-mx es-ni es-pa es-pe es-pr es-py es-sv es-us es-uy es-ve es-xl ++es es-ar es-bo es-cl es-cu es-co es-do es-ec es-es es-pe es-pr es-py es-us es-uy es-ve es-xl spq ++es-mx es-bz es-cr es-gt es-hn es-ni es-pa es-sv + et et-ee + fa fa-fa fa-ir + fi fi-fi +diff --git a/errors/language.am b/errors/language.am +index 12b1b2b3b43..029e8c1eb2f 100644 +--- a/errors/language.am ++++ b/errors/language.am +@@ -17,6 +17,7 @@ TRANSLATE_LANGUAGES = \ + de.lang \ + el.lang \ + en.lang \ ++ es-mx.lang \ + es.lang \ + et.lang \ + fa.lang \ +@@ -51,4 +52,4 @@ TRANSLATE_LANGUAGES = \ + uz.lang \ + vi.lang \ + zh-hans.lang \ +- zh-hant.lang ++ zh-hant.lang +diff --git a/errors/template.am b/errors/template.am +index 6c12781e6f4..715c65aa22b 100644 +--- a/errors/template.am ++++ b/errors/template.am +@@ -48,4 +48,4 @@ ERROR_TEMPLATES = \ + templates/ERR_UNSUP_REQ \ + templates/ERR_URN_RESOLVE \ + templates/ERR_WRITE_ERROR \ +- templates/ERR_ZERO_SIZE_OBJECT ++ templates/ERR_ZERO_SIZE_OBJECT diff --git a/squid-gcc11.patch b/squid-gcc11.patch deleted file mode 100644 index c87ade5..0000000 --- a/squid-gcc11.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/acl/ConnMark.cc b/src/acl/ConnMark.cc -index 1fdae0c..213cf39 100644 ---- a/src/acl/ConnMark.cc -+++ b/src/acl/ConnMark.cc -@@ -15,6 +15,7 @@ - #include "Debug.h" - #include "http/Stream.h" - #include "sbuf/Stream.h" -+#include - - bool - Acl::ConnMark::empty() const -diff --git a/src/security/ServerOptions.cc b/src/security/ServerOptions.cc -index 5cd81ab..3f73892 100644 ---- a/src/security/ServerOptions.cc -+++ b/src/security/ServerOptions.cc -@@ -6,6 +6,7 @@ - * Please see the COPYING and CONTRIBUTORS files for details. - */ - -+#include - #include "squid.h" - #include "anyp/PortCfg.h" - #include "base/Packable.h" diff --git a/squid.spec b/squid.spec index 7bfc16f..4e7ca28 100644 --- a/squid.spec +++ b/squid.spec @@ -1,16 +1,16 @@ %define __perl_requires %{SOURCE98} Name: squid -Version: 4.14 -Release: 2%{?dist} +Version: 5.0.5 +Release: 4%{?dist} Summary: The Squid proxy caching server Epoch: 7 # See CREDITS for breakdown of non GPLv2+ code License: GPLv2+ and (LGPLv2+ and MIT and BSD and Public Domain) URL: http://www.squid-cache.org -Source0: http://www.squid-cache.org/Versions/v4/squid-%{version}.tar.xz -Source1: http://www.squid-cache.org/Versions/v4/squid-%{version}.tar.xz.asc +Source0: http://www.squid-cache.org/Versions/v5/squid-%{version}.tar.xz +Source1: http://www.squid-cache.org/Versions/v5/squid-%{version}.tar.xz.asc Source2: http://www.squid-cache.org/pgp.asc Source3: squid.logrotate Source4: squid.sysconfig @@ -32,8 +32,10 @@ Patch201: squid-4.0.11-config.patch Patch202: squid-3.1.0.9-location.patch Patch203: squid-3.0.STABLE1-perlpath.patch Patch204: squid-3.5.9-include-guards.patch -Patch205: squid-4.0.21-large-acl.patch -Patch206: squid-gcc11.patch +Patch205: squid-5.0.5-build-errors.patch +# revert this upstream patch - https://bugzilla.redhat.com/show_bug.cgi?id=1936422 +# workaround for #1934919 +Patch206: squid-5.0.5-symlink-lang-err.patch # cache_swap.sh Requires: bash gawk @@ -52,8 +54,8 @@ BuildRequires: pam-devel BuildRequires: openssl-devel # squid_kerb_aut requires Kerberos development libs BuildRequires: krb5-devel -# time_quota requires DB -BuildRequires: libdb-devel +# time_quota requires TrivialDB +BuildRequires: libtdb-devel # ESI support requires Expat & libxml2 BuildRequires: expat-devel libxml2-devel # TPROXY requires libcap, and also increases security somewhat @@ -103,8 +105,8 @@ lookup program (dnsserver), a program for retrieving FTP data %patch202 -p1 -b .location %patch203 -p1 -b .perlpath %patch204 -p0 -b .include-guards -%patch205 -p1 -b .large_acl -%patch206 -p1 -b .gcc11 +%patch205 -p1 -b .build-errors +%patch206 -p1 -R -b .symlink-lang-err # https://bugzilla.redhat.com/show_bug.cgi?id=1679526 # Patch in the vendor documentation and used different location for documentation @@ -162,6 +164,11 @@ sed -i 's|@SYSCONFDIR@/squid.conf.documented|%{_pkgdocdir}/squid.conf.documented --disable-strict-error-checking \ --with-swapdir=%{_localstatedir}/spool/squid +# workaround to build squid v5 +mkdir -p src/icmp/tests +mkdir -p tools/squidclient/tests +mkdir -p tools/tests + %make_build %check @@ -222,6 +229,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/squid/squid.conf.documented # remove unpackaged files from the buildroot rm -f $RPM_BUILD_ROOT/squid.httpd.tmp + %files %license COPYING %doc CONTRIBUTORS README ChangeLog QUICKSTART src/squid.conf.documented @@ -282,6 +290,39 @@ done exit 0 +%pretrans -p +-- temporarilly commented until https://bugzilla.redhat.com/show_bug.cgi?id=1936422 is resolved +-- +-- previously /usr/share/squid/errors/es-mx was symlink, now it is directory since squid v5 +-- see https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/ +-- Define the path to the symlink being replaced below. +-- +-- path = "/usr/share/squid/errors/es-mx" +-- st = posix.stat(path) +-- if st and st.type == "link" then +-- os.remove(path) +-- end + +-- Due to a bug #447156 +paths = {"/usr/share/squid/errors/zh-cn", "/usr/share/squid/errors/zh-tw"} +for key,path in ipairs(paths) +do + st = posix.stat(path) + if st and st.type == "directory" then + status = os.rename(path, path .. ".rpmmoved") + if not status then + suffix = 0 + while not status do + suffix = suffix + 1 + status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) + end + os.rename(path, path .. ".rpmmoved") + end + end +end + + + %post %systemd_post squid.service @@ -300,6 +341,11 @@ fi %changelog +* Wed Feb 10 2021 Lubos Uhliarik - 7:5.0.5-1 +- new version 5.0.5 +- Resolves: #1952896 - Rebase squid to >= 5.0.5 +- Resolves: #1940412 - Remove libdb dependency from squid + * Fri Apr 16 2021 Mohan Boddu - 7:4.14-2 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937