Problem with parameterized macro when an option contains '--'
Tadej Janež
tadej.j at nez.si
Sat Oct 31 21:25:11 UTC 2015
Hi!
Let's take the %systemd_post macro [1] as an example of a parameterized
macro:
%systemd_post() \
if [ $1 -eq 1 ] ; then \
# Initial installation \
systemctl preset %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
If the macro is called with ordinary options (e.g. 'foo', 'bar'), it
works as expected:
[vagrant at localhost ~]$ rpm --eval "%systemd_post foo bar"
if [ $1 -eq 1 ] ; then
# Initial installation
systemctl preset foo bar >/dev/null 2>&1 || :
fi
But if a user tries to pass it an option that contains '--' (e.g.
'--user'), rpm returns an error:
[vagrant at localhost ~]$ rpm --eval "%systemd_post --user foo bar"
systemd_post: invalid option -- '-'
error: Unknown option - in systemd_post()
if [ $1 -eq 1 ] ; then
# Initial installation
systemctl preset >/dev/null 2>&1 || :
fi
Is this a bug in rpm's parameterized macro handling or should options
containing '--' be passed in a different way?
Thanks and regards,
Tadej
P.S.: I tested this on Fedora 23 beta with
rpm-4.13.0-0.rc1.3.fc23.x86_64.
[1]
https://github.com/systemd/systemd/blob/7c67f0f/src/core/macros.systemd.in#L39
More information about the Rpm-list
mailing list