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

Daniel P. Berrangé berrange at redhat.com
Wed Mar 21 08:48:21 UTC 2018


On Tue, Mar 20, 2018 at 07:13:24PM +0100, Andrea Bolognani wrote:
> 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.

No that is not the case. On every release I synchronize the libvirt
upstream spec into the Fedora spec. The only thing different about
Fedora spec is that it has changelog entries. That's why we go to the
trouble of making sure conditionals cope with multiple distros in our
upstream spec.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list