Bug 1481025 - Macro argument quoting in rpm 4.14 breaks things (octave, java...)
Macro argument quoting in rpm 4.14 breaks things (octave, java...)
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
All Linux
unspecified Severity high
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
: 1481133 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2017-08-13 11:23 EDT by Orion Poplawski
Modified: 2017-09-07 07:27 EDT (History)
10 users (show)

See Also:
Fixed In Version: rpm-4.13.90-0.git14002.3.fc27
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-09-07 07:27:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Orion Poplawski 2017-08-13 11:23:21 EDT
Description of problem:

ENTER ['do'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target noarch --nodeps /builddir/build/SPECS/octave-statistics.spec'], logger=<mockbuild.trace_decorator.getLog object at 0x3fff945826d8>timeout=172800user='mockbuild'printOutput=Falseenv={'SHELL': '/bin/bash', 'HOME': '/builddir', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'HOSTNAME': 'mock'}gid=425uid=1000shell=FalsechrootPath='/var/lib/mock/f27-build-9511079-776071/root'nspawn_args=[])
Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target noarch --nodeps /builddir/build/SPECS/octave-statistics.spec'] with env {'SHELL': '/bin/bash', 'HOME': '/builddir', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'HOSTNAME': 'mock'} and shell False
octave_cmd: invalid option -- 'n'
error: Unknown option n in octave_cmd()
error: line 31: %octave_pkg_install


%octave_pkg_install \
mkdir -p %{buildroot}%{octprefix} \
mkdir -p %{buildroot}%{octarchprefix} \
%octave_cmd pkg("prefix","%{buildroot}%{octprefix}","%{buildroot}%{octarchprefix}");pkg("global_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("local_list",fullfile("%{buildroot}%{octshareprefix}","octave_packages"));pkg("install","-nodeps","-verbose","%{_builddir}/%{buildsubdir}/build/%{octpkg}-%{version}-%{octave_tar_suffix}.tar.gz");unlink(pkg("local_list"));unlink(pkg("global_list")); \
if [ -e %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m ] \
then \
  mv %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m.orig \
fi \
echo "function on_uninstall (desc)" > %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \
echo "  error ('Can not uninstall %s installed by the redhat package manager', desc.name);" >> %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \
echo "endfunction" >> %{buildroot}%{octpkgdir}/packinfo/on_uninstall.m \
if [ -e %{_builddir}/%{buildsubdir}/build/%{octpkg}-%{version}/octave-%{octpkg}.metainfo.xml ] \
then \
  echo "Found octave-%{octpkg}.metainfo.xml" \
  mkdir -p %{buildroot}/%{_datadir}/appdata \
  cp -p %{_builddir}/%{buildsubdir}/build/%{octpkg}-%{version}/octave-%{octpkg}.metainfo.xml %{buildroot}/%{_datadir}/appdata/ \
  appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/octave-%{octpkg}.metainfo.xml \
fi \

%octave_cmd() octave -H -q --no-window-system --no-site-file --eval '%*';

Version-Release number of selected component (if applicable):
Comment 1 Panu Matilainen 2017-08-14 04:22:11 EDT
Yup. The problem is the new macro argument quoting support, which cannot be turned off or escaped otherwise. After sleeping over this, starting to remember various other macro constructs that are going to be affected... and as if on cue, in comes bug 1481133.

It's fairly clear that the behavior is just too incompatible with widely used macros, it needs a different syntax or some kind of opt-in behavior.
Comment 2 Panu Matilainen 2017-08-14 04:22:45 EDT
*** Bug 1481133 has been marked as a duplicate of this bug. ***
Comment 3 Panu Matilainen 2017-08-14 05:28:04 EDT
Macro argument quoting is now disabled in rpm >= 4.13.90-0.git14002.3.fc27.

Back to the drawing board upstream (https://github.com/rpm-software-management/rpm/issues/222)
Comment 4 Vít Ondruch 2017-08-14 06:09:53 EDT
I guess the rubygem-sdoc build failure [1] is of the same nature, so probably other rubygem- packages are broken now as well ...

[1] https://apps.fedoraproject.org/koschei/package/rubygem-sdoc?collection=f27
Comment 5 Paul Howarth 2017-08-14 06:29:54 EDT
And svnmailer, where it doesn't like:

 %py2_install "--install-data=%{_datadir}"

Comment 6 Jan Kurik 2017-08-15 03:54:05 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.
Comment 7 Panu Matilainen 2017-09-07 07:27:06 EDT
To summarize, the single/double quoting support of macro arguments was reverted as it simply broke too much stuff. Rpm 4.14.0 rc1 and newer support an alternative way of quoting macro arguments: a new special-purpose %{quote:...} macro, which allows passing empty arguments and arguments with spaces as single arguments.

For example, with the following parametric macro definition:

%args() echo argc %#: %{?1:"%1"} %{?2:"%2"}

[pmatilai@sopuli ~]$ rpm --eval "%args %{nil}"
argc 0:  
[pmatilai@sopuli ~]$ rpm --eval "%args %{quote:%{nil}}"
argc 1: "" 
[pmatilai@sopuli ~]$ rpm --eval "%args some text"
argc 2: "some" "text"
[pmatilai@sopuli ~]$ rpm --eval "%args %{quote:some text}"
argc 1: "some text"

Note You need to log in before you can comment on or make changes to this bug.