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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 20, 2018 at 01:57:16PM -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.
> 
> I forgot to ask this in the previous message - would it be reasonable to
> have a syntax-check rule that forbid any line in libvirt.spec.in that
> started with "<whitespace>%" and ended with \ ? (Personally I had no
> idea of this rule, and I'm sure most others didn't either).

Unfortunately it is hard to distinguish from a %macro that is accepting
arguments, vs a %macro that is just expanding to a plain variable, so
something like  grep '%.*\\' has too many false positives.


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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux