]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpm: fix incorrect expansion of macros with line continuations for args
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 20 Mar 2018 16:55:12 +0000 (16:55 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 21 Mar 2018 14:46:08 +0000 (14:46 +0000)
Macros in RPMs are expanded before line continuations, so when we write

   %systemd_preun foo \
                  bar

What happens is that it expands to

   if [ $1 -eq 0 ] ; then
        # Package removal, not upgrade
        systemctl --no-reload disable --now foo \ > /dev/null 2>&1 || :
   fi
                 bar

which is obviously complete garbage and not what we expected. It is
simply not safe to ever use line continuations in combination with
macros.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
libvirt.spec.in

index d6e387951bec030ae083ac2fc31e9c3ea19a303b..b55a947ec9ffd894a24d3ffe6adddd3a323c324b 100644 (file)
@@ -1519,9 +1519,9 @@ exit 0
 
 %if %{with_systemd}
     %if %{with_systemd_macros}
-        %systemd_post virtlockd.socket virtlockd-admin.socket \
-            virtlogd.socket virtlogd-admin.socket \
-            libvirtd.service
+        %systemd_post virtlockd.socket virtlockd-admin.socket
+        %systemd_post virtlogd.socket virtlogd-admin.socket
+        %systemd_post libvirtd.service
     %else
 if [ $1 -eq 1 ] ; then
     # Initial installation
@@ -1556,9 +1556,9 @@ touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :
 %preun daemon
 %if %{with_systemd}
     %if %{with_systemd_macros}
-        %systemd_preun libvirtd.service \
-            virtlogd.socket virtlogd-admin.socket virtlogd.service \
-            virtlockd.socket virtlockd-admin.socket virtlockd.service
+        %systemd_preun libvirtd.service
+        %systemd_preun virtlogd.socket virtlogd-admin.socket virtlogd.service
+        %systemd_preun virtlockd.socket virtlockd-admin.socket virtlockd.service
     %else
 if [ $1 -eq 0 ] ; then
     # Package removal, not upgrade