[libvirt] [PATCH] rpm: fix incorrect expansion of %systemd_preun macro

Andrea Bolognani abologna at redhat.com
Tue Mar 20 18:13:24 UTC 2018


On Tue, 2018-03-20 at 13:54 -0400, Laine Stump wrote:
> On 03/20/2018 01:00 PM, Daniel P. Berrangé wrote:
> > 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.
> 
> Introduced in commit bffdd6c3034164127b1543ffd2e9ed599baf4838, present
> in released libvirt-4.1.0.
> 
> 
> This is going to be problematic for any rpm-based distro that has a
> 4.1.0 rpm, e.g. Fedora rawhide and F28 - if someone has updated to the
> broken rpm, they won't be able to get rid of it with a plain update, and
> dnf has no command that passes through the necessary --nopreun command
> to rpm. Instead, they'll need to run rpm manually - "rpm --nopreun blah
> blah".
> 
> If there is already a 4.1.0-maint branch, we should pull this patch back
> to there, and think about how to notify the poor F28/rawhide users of
> their predicament (hopefully there aren't too many, as F28 isn't yet
> released)

IIUC Fedora and other distributions each have their own spec file
which, while probably derived from and for the most part identical
to the upstream one, is actually maintained separately.

Assuming the above is correct, I'd argue the fix is possibly not
even worth backporting to the maintenance branch. The downstream
maintainers, on the other hand, should definitely be notified of
the issue so that they can make sure their own spec files are not
affected by it.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list