[Rpm-maint] [rpm-software-management/rpm] rpm's doFoo function tends to expand twice (#313)

Jeff Johnson notifications at github.com
Tue Sep 5 06:11:51 UTC 2017


The important points here that needs to be considered:
    The re-expansion of a string without a '%' character is entirely transparent.
 (i.e. the examples presented here are highly artificial).

Basically: It Really Doesn't Matter.

Changing how rpm does escaping is going to be highly annoying because the most complex (i.e. overly complex imho) expansions are typically what need escaping of any sort, and complex macros are the hardest to debug when they break. And break they will if you change rpm macro escaping ...

%expand is actually a hack, much like %quote is a hack: rpm needed to be released, and there was no time to sort out some (silly imho) blocker packaging problem). I've long since forgotten whatever the issue was *shrug*

%P and %S are hysterical artifacts trying to eliminate macros-implemented-in-C: I doubt they are of any use outside of this replacement for %patch:

```
#
# The patch macro writes 1 line of shell code to (optionally) uncompress
# a file and apply using patch(1).
#

%patch(b:p:P:REz:F:d:) %{shrink:\
%define __patch_number  %{-P:%{-P*}}%{!-P:0} \
%define __patch_file    %{P:%{__patch_number}} \
%define __patch_suffix  %{-b:-b --suffix %{-b*}} %{-z:--suffix %{-z*}} \
%define __patch_fuzz    %{?_default_patch_fuzz:%(test %{_default_patch_fuzz} -ge 0 && echo "--fuzz=%{_default_patch_fuzz} ")} \
%define __patch_options %{_default_patch_flags} %{-p:-p%{-p*}} %{-F:-F%{-F*}} %{-d:-d%{-d*}} %{-R} %{-E} %{__patch_suffix} \
echo "Patch #%{__patch_number} (%{basename:%{__patch_file}}):" && ( %{uncompress:%{__patch_file}} | %{__patch} %{__patch_fuzz}%{__patch_options} ) || exit 1\
}
```

(aside)
The effort was abandoned because a pure macro replacement for %setup (with multiple options) was too much hassle. Now that popt can handle multiple options (with POPT_ARG_ARGV) it might be doable, but even there one has to handle integer coercion, ... *shrug*

I'd suggest just ripping out %P and %S: they are useless in practice.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/313#issuecomment-327080542
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20170905/c92a9b13/attachment.html>


More information about the Rpm-maint mailing list