This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 192506 - rpmlint incorrectly sees comments as code in %post and %postun
rpmlint incorrectly sees comments as code in %post and %postun
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: rpmlint (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ville Skyttä
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-20 02:44 EDT by Chris Petersen
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-05-20 03:19:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Chris Petersen 2006-05-20 02:44:24 EDT
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 03:02:05 EDT
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 03:19:55 EDT
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.