Bug 1481025

Summary: Macro argument quoting in rpm 4.14 breaks things (octave, java...)
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 27CC: cbm, ignatenko, kardos.lubos, mjw, msimacek, packaging-team-maint, paul, pmatilai, vmukhame, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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: Environment:
Last Closed: 2017-09-07 11:27:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Orion Poplawski 2017-08-13 15:23:21 UTC
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

%install
%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 \
%{nil}


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

Version-Release number of selected component (if applicable):
4.13.90-0.git14002.2.fc27

Comment 1 Panu Matilainen 2017-08-14 08:22:11 UTC
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 08:22:45 UTC
*** Bug 1481133 has been marked as a duplicate of this bug. ***

Comment 3 Panu Matilainen 2017-08-14 09:28:04 UTC
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 10:09:53 UTC
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 10:29:54 UTC
And svnmailer, where it doesn't like:

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

https://apps.fedoraproject.org/koschei/package/svnmailer?collection=f27

Comment 6 Jan Kurik 2017-08-15 07:54:05 UTC
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 11:27:06 UTC
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"