Comments in spec files (was Re: Plan for tomorrows (20070517) FESCO meeting)
Michael Schwendt
bugs.michael at gmx.net
Sat May 19 14:32:44 UTC 2007
On Sat, 19 May 2007 16:11:15 +0200, Denis Leroy wrote:
> >> # Like this
> >> ## or this in many script languages.
> >>
> >>> I remember a few years ago I was asked to remove all '# comments'
> >>> lines from scriptlets apparently because they "could cause problems"...
> >>
> >> No. You were only asked to not add such comment lines _after_ scriptlet
> >> sections in the spec file, because the comments would be included in the
> >> scriptlet bodies, even if a scriptlet section is passed to
> >> /sbin/ldconfig,
> >> which doesn't understand the contents and breaks badly.
>
> Not enough coffee. You meant "after scriptlet sections ON THE SAME LINE"
> as in
>
> %post -p /sbin/ldconfig # bad comment
That one would not even rpmbuild. ;)
Rule of thumb: Avoid comment lines after %post/postun/pre/preun (and likely
also the trigger sections) up to the next non-scriptlet section.
This is what I refer to:
...
%post -p /sbin/ldconfig
# These comment lines are included in the %post script.
# *Everything* up to the following script section is included.
# See: rpm --query --scripts ...
%postun -p /sbin/ldconfig
# And this comment is included in the %postun (!) script and
# breaks ldconfig, too.
%check
...
Note that even if the script sections were executed with default /bin/sh,
comments _before_ a %post/postun/... section would make it into the
previous [and hence wrong] script body.
More information about the Fedora-maintainers
mailing list