public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: Disable macro argument quoting as a band-aid to #1481025
Date: Mon, 23 Nov 2026 09:31:25 GMT [thread overview]
Message-ID: <179542628573.1.7076330632640677864.rpms-rpm-351ab493155b@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 351ab493155b5bff02f5b8de4a9f62c0f07c1606
Author : Panu Matilainen <pmatilai@redhat.com>
Date : 2017-08-14T11:51:21+03:00
Stats : +154/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/351ab493155b5bff02f5b8de4a9f62c0f07c1606?branch=pmatilai-v6
Log:
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 <pmatilai@redhat.com> - 4.13.90-0.git14000.3
+- Disable macro argument quoting as a band-aid to #1481025
+
* Fri Aug 11 2017 Panu Matilainen <pmatilai@redhat.com> - 4.13.90-0.git14000.2
- Disable SHA256 header-only digest generation temporarily (#1480407)
reply other threads:[~2026-11-23 9:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542628573.1.7076330632640677864.rpms-rpm-351ab493155b@fedoraproject.org \
--to=pmatilai@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox