[Rpm-maint] [PATCH] forbid #%define

Panu Matilainen pmatilai at laiskiainen.org
Fri Jun 6 14:56:49 UTC 2008


On Fri, 6 Jun 2008, Peter Bowen wrote:

> On Fri, 2008-06-06 at 17:33 +0300, Panu Matilainen wrote:
>> On Fri, 6 Jun 2008, Pixel wrote:
>>> Panu Matilainen <pmatilai at redhat.com> writes:
>>>
>>>> A very straightforward and simple rule would be "if the first
>>>> character of the text to process starts is "#", braces are required to perform
>>>> macro expansion"
>>>
>>> i'd rather not introduce such a difference between %foo and %{foo}
>>> just for the sake of comments. Too surprising IMO.
>>
>> I'm not saying it's necessarily "the right thing", but is it really more
>> surprising than #-commenting not honored in specs which started this
>> thread? :) Remember, the only thing the patch affects is macros on
>> commented lines and nothing else.
>
> There are lots of other instances of # not being honored in specs.

Yes, and many many other ugly quirks too. Feel free to bring 'em on and 
lets try to see if there are ways to fix them without inventing an 
entirely new spec syntax at once. (although in many ways that'd probably 
be the best thing to do ;)

> For example, lots of spec comments end up in scriptlets because someone 
> did
>
> %pre
> ..
>
> # Remember to fix the call to fuzz in postun once we fix the main binary
> %postun
> ..
>
> %files
>
> The comment ends up as the last line of the %pre scriptlet.

Yup, I remember fedora.us project getting bitten by this too by using 
excessive comments like this between different sections:
# ---------------------------------------

That broke "%post -p /sbin/ldconfig" in entertaining ways when it tried to 
interpret the #---- line...

This is quite a different issue from the macros-in-comments though, fully 
solving it would require markers for both section start and end, so that 
the comments would land in "no mans land" in spec instead of the previous 
section. Or if those lines were to be stripped altogether by build, you'd 
lose any comments in the actual scriptlets (how important those are might 
be somewhat questionable though). Or you'd have to have yet another way to 
escape comments that aren't meant to go into the scriptlets...

 	- Panu -



More information about the Rpm-maint mailing list