Bug 192506 - rpmlint incorrectly sees comments as code in %post and %postun
Summary: rpmlint incorrectly sees comments as code in %post and %postun
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmlint
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-05-20 06:44 UTC by Chris Petersen
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-05-20 07:19:55 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Chris Petersen 2006-05-20 06:44:24 UTC
Description of problem:

rpmlint incorrectly sees comments as code in %post and %postun

Version-Release number of selected component (if applicable):

0.76

How reproducible:

always

Steps to Reproduce:

see http://forevermore.net/files/packages/lineak/lineakd.spec

I use long strings of comment characters to separate files in some of the more
complex specs I produce.  To keep consistent, I add them to the simpler ones,
too (I think it makes the a LOT easier to read).

Anyway, the comments around %post and %postun produce the following errors from
rpmlint:

E: lineakd postin-without-ldconfig /usr/lib64/liblineak.so.0.8.0
E: lineakd postun-without-ldconfig /usr/lib64/liblineak.so.0.8.0
E: lineakd non-empty-%post /sbin/ldconfig
W: lineakd one-line-command-in-%post ####################################
E: lineakd non-empty-%postun /sbin/ldconfig
W: lineakd one-line-command-in-%postun ####################################

(I've shortened that #### stuff to make it fir on one line here)

Removing the comment lines after %post and %postun clears up the problem, as
does replacing:

   %post -n /sbin/ldconfig

with:

   %post
   /sbin/ldconfig

(and the same with %postun)

Anyway, seems prudent to me to ignore non-executable comments in those fields
(whether separators or actual comments) before warning or erroring out about them.

Just for reference, this spec is from a pending package for extras:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=191604

Comment 1 Chris Petersen 2006-05-20 07:02:05 UTC
Turns out that the problematic formatting mentioned above also causes script
execution errors during rpm installation and removal.

Since I'm trying to update this package to work, I've replaced the broken script
with one that works...

Works:   http://forevermore.net/files/packages/lineak/lineakd.spec
Broken:  http://forevermore.net/files/packages/lineak/lineakd.brokenscript.spec

The only difference between these (for now) is that I applied the fix I
mentioned above.

Anyway, I still think this is a bug, but obviously extends beyond just rpmlint.
 Feel free to close this or move it over to rpm as needed.

Comment 2 Ville Skyttä 2006-05-20 07:19:55 UTC
Try running "rpm -q --specfile lineakd.spec --scripts" on your specfile.

The problem with those comments is that they get passed on to the corresponding
script interpreter (/bin/bash by default, /sbin/ldconfig if you use eg. %post -p
/sbin/ldconfig).  So depending on the interpreter, they may not be actually
comments, and some versions of ldconfig at least used to choke on things like
"###########" being fed to it.

So, you're looking for comment syntax for specfiles.  As far as I know, such a
thing doesn't not exist.

When you don't use the %post -p /sbin/ldconfig syntax, your %post script is
executed with the default script interpreter, /bin/bash.  ######... is a comment
in bash, so it works.  However, because you're not using the %post -p
/sbin/ldconfig syntax, rpmbuild won't autogenerate the dependency on
/sbin/ldconfig for your %post and friends scripts, and results in a unneeded
shell invocation to run your one-liner script, which is why rpmlint whines about
one line commands in scriptlets and asks one to use the -p syntax instead.


Note You need to log in before you can comment on or make changes to this bug.