From 351ab493155b5bff02f5b8de4a9f62c0f07c1606 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Aug 14 2017 08:51:21 +0000 Subject: Disable macro argument quoting as a band-aid to #1481025 Too many existing macros heavily rely on quotes passing untouched, needs a different approach upstream. --- diff --git a/rpm-4.13.90-macro-noquote.patch b/rpm-4.13.90-macro-noquote.patch new file mode 100644 index 0000000..eba9534 --- /dev/null +++ b/rpm-4.13.90-macro-noquote.patch @@ -0,0 +1,147 @@ +diff -up rpm-4.13.90-git14002/rpmio/macro.c.noquote rpm-4.13.90-git14002/rpmio/macro.c +--- rpm-4.13.90-git14002/rpmio/macro.c.noquote 2017-08-14 11:43:41.160400779 +0300 ++++ rpm-4.13.90-git14002/rpmio/macro.c 2017-08-14 11:43:58.924398809 +0300 +@@ -649,61 +649,6 @@ freeArgs(MacroBuf mb, int delete) + mb->level--; + } + +-/* XXX: belongs to argv.c but figure a sensible API before making public */ +-static ARGV_t argvSplitShell(const char * str, const char * seps) +-{ +- char *dest = NULL; +- ARGV_t argv; +- int argc = 1; +- const char * s; +- char * t; +- int c; +- int quote; +- +- if (str == NULL || seps == NULL) +- return NULL; +- +- dest = xmalloc(strlen(str) + 1); +- t = dest; +- s = str; +- argc = 1; +- +- while ((c = *s)) { +- if (strchr(seps, c)) { +- s++; +- } else { +- if (!strchr("\"\'",c)) { +- /* read argument not in "" or ''*/ +- for (; (c = *s); s++, t++) { +- if (strchr(seps, c) || strchr("\"\'",c)) +- break; +- *t = c; +- } +- } else { +- /* read argument in "" or '' */ +- quote = *s; +- s++; +- for (; (c = *s) && (c != quote); t++,s++) +- *t = c; +- s++; +- } +- *t = '\0'; +- t++; +- argc++; +- } +- } +- *t = '\0'; +- +- argv = xmalloc((argc + 1) * sizeof(*argv)); +- for (c = 0, s = dest; s < t; s+= strlen(s) + 1) { +- argv[c] = xstrdup(s); +- c++; +- } +- argv[c] = NULL; +- free(dest); +- return argv; +-} +- + /** + * Parse arguments (to next new line) for parameterized macro. + * @todo Use popt rather than getopt to parse args. +@@ -740,7 +685,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntr + expandThis(mb, se, lastc-se, &s); + mb->escape = oescape; + +- av = argvSplitShell(s, " \t"); ++ av = argvSplitString(s, " \t", ARGV_SKIPEMPTY); + argvAppend(&argv, av); + argvFree(av); + free(s); +diff -up rpm-4.13.90-git14002/tests/rpmmacro.at.noquote rpm-4.13.90-git14002/tests/rpmmacro.at +--- rpm-4.13.90-git14002/tests/rpmmacro.at.noquote 2017-08-14 11:39:38.512426695 +0300 ++++ rpm-4.13.90-git14002/tests/rpmmacro.at 2017-08-14 11:40:18.807422527 +0300 +@@ -268,69 +268,6 @@ runroot rpm \ + ) + AT_CLEANUP + +-AT_SETUP([macro arguments in double quotes]) +-AT_KEYWORDS([macros arguments]) +-AT_CHECK([ +-runroot rpm --define "%foo() 1:%1 2:%2" --eval '%foo "argument 1" argument_2' +- +-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval '%foo "argument 1" argument_2 """"""' +- +-runroot rpm \ +- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval '%foo "arg. number 1""arg. number 2" "arg number 3" "" normal' +- +-runroot rpm \ +- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval '%foo "arg. number 1"normal"arg. number 2" ' +- +-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval '%foo """jjj"""aa"" ' +- +-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" --eval '%foo xx"yy""zz""""bb" ' +-], +-[0], +-[1:argument 1 2:argument_2 +-1:argument 1 2:argument_2 3: 4: 5: +-1:arg. number 1 2:arg. number 2 3:arg number 3 4: 5:normal +-1:arg. number 1 2:normal 3:arg. number 2 4:%4 5:%5 +-1: 2:jjj 3: 4:aa 5: +-1:xx 2:yy 3:zz 4: 5:bb +-]) +-AT_CLEANUP +- +-AT_SETUP([macro arguments in single + double quotes]) +-AT_KEYWORDS([macros arguments]) +-AT_CHECK([ +- +-runroot rpm \ +- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval "%foo 'arg. number 1''arg. number 2' 'arg number 3' '' normal" +- +-runroot rpm \ +- --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval "%foo 'arg. number 1'normal'arg. number 2'''normal " +- +-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval "%foo '''jjj'''aa'' " +- +-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" \ +- --eval "%foo ''\"jjj\"''aa\"\" " +- +-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" --eval "%foo xx'yy''zz''''bb' " +- +-runroot rpm --define "%foo() 1:%1 2:%2 3:%3 4:%4 5:%5" --eval "%foo xx'yy'\"zz\"\"\"'bb' " +-], +-[0], +-[1:arg. number 1 2:arg. number 2 3:arg number 3 4: 5:normal +-1:arg. number 1 2:normal 3:arg. number 2 4: 5:normal +-1: 2:jjj 3: 4:aa 5: +-1: 2:jjj 3: 4:aa 5: +-1:xx 2:yy 3:zz 4: 5:bb +-1:xx 2:yy 3:zz 4: 5:bb +-]) +-AT_CLEANUP +- + AT_SETUP([%undefine from different scopes]) + AT_KEYWORDS([macros %undefine]) + AT_CHECK([ diff --git a/rpm.spec b/rpm.spec index 89277d6..c90f848 100644 --- a/rpm.spec +++ b/rpm.spec @@ -29,7 +29,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}2%{?dist} +Release: %{?snapver:0.%{snapver}.}3%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2 @@ -53,6 +53,9 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch # rpm 4.13 rpmkeys -K is buggy and chokes on the new sha256 header digest, # disable its generation until fixed in other fedora versions (#1480407) Patch6: rpm-4.14-disable-sha256hdr.patch +# Macro argument quoting breaks too much stuff, disable until a better +# solution is found upstream (#1481025) +Patch7: rpm-4.13.90-macro-noquote.patch # Patches already upstream: @@ -568,6 +571,9 @@ exit 0 %doc doc/librpm/html/* %changelog +* Mon Aug 14 2017 Panu Matilainen - 4.13.90-0.git14000.3 +- Disable macro argument quoting as a band-aid to #1481025 + * Fri Aug 11 2017 Panu Matilainen - 4.13.90-0.git14000.2 - Disable SHA256 header-only digest generation temporarily (#1480407)