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

Laine Stump laine at laine.org
Wed Mar 21 13:13:09 UTC 2018


On 03/21/2018 05:55 AM, Daniel P. Berrangé wrote:
> On Tue, Mar 20, 2018 at 01:54:49PM -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".
> It is not quite as bad as I feared. When I upgraded using dnf i get this
>
>   Running scriptlet: libvirt-daemon-4.1.0-1.fc27.x86_64                                                         144/146 
> /var/tmp/rpm-tmp.wB7JPz: line 6: virtlogd.socket: command not found
> error: %preun(libvirt-daemon-4.1.0-1.fc27.x86_64) scriptlet failed, exit status 127
> Error in PREUN scriptlet in rpm package libvirt-daemon
> Error in PREUN scriptlet in rpm package libvirt-daemon
>
> And as a result have this:
>
> # rpm -q libvirt-daemon
> libvirt-daemon-4.1.0-1.fc27.x86_64
> libvirt-daemon-4.1.0-2.fc27.x86_64
>
> This is merely a cosmetic problem though - all the files from the
> outdated version are gone. 

And then can the cosmetic problem be safely solved with "rpm -e --nodeps
--noscripts --justdb libvirt-daemon-4.1.0-1"? (or maybe not all of those
are required?)




More information about the libvir-list mailing list