Bug 239611

Summary: percent-in-%post false positive
Product: [Fedora] Fedora Reporter: Bernard Johnson <bjohnson>
Component: rpmlintAssignee: Ville Skyttä <ville.skytta>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.81-1.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-07 17:21:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bernard Johnson 2007-05-09 20:59:55 UTC
Description of problem:
I think I'm right here anyway...

The following shell fragement generates a false positive:
let rand=${RANDOM}%%${max}

If rpmlint encounters %% it should not report this.

rpmlint mypackage.rpm
W: mypackage percent-in-%post

Version-Release number of selected component (if applicable):
rpmlint-0.80-1.fc6

Comment 1 Ville Skyttä 2007-05-10 06:52:02 UTC
(In reply to comment #0)
> The following shell fragement generates a false positive:
> let rand=${RANDOM}%%${max}
> 
> If rpmlint encounters %% it should not report this.

There seems to be some bogosity in the percent-in-* check indeed, but note that
rpmlint does not encounter a "%%", PostCheck.py which reports the warning sees a
single "%" as it basically inspects the equivalent of the output of rpm -qp
--scripts mypackage.rpm

Comment 2 Bernard Johnson 2007-05-10 18:01:18 UTC
Oh, I think I see now.  So when it sees a % in the output of rpm -qp --scripts
mypackage.rpm, it thinks that some important macro may have not been substituted?

Seems like it would be safe to only look for %[a-z,A-Z]* though.

Comment 3 Ville Skyttä 2007-05-10 19:36:53 UTC
Right.  In case you've looked at the code, I have absolutely no idea why it
first checks if there's a (shell-uncommented) %, then if there's a %%, and if
the latter is found, it doesn't warn.  Maybe a thinko by whoever wrote that code.

I suppose using simply the regexp %{?\w would be a candidate fix.

Comment 4 Jeff Johnson 2007-05-11 02:23:27 UTC
The usage case for '%' within %post et al scriptlets is very obscure, and likely
to get worse when I expand scriptlets at install, not build, time by escaping
macro expansions.

FWIW a seiries of %%% followed by { is likelier to be an unexpanded -- which is an error - or
intentionally delayed by escaping -- which is not an error -- macro expansion than any conceivable
shell or CLI usage of %.


Comment 5 Ville Skyttä 2007-05-12 08:58:54 UTC
Yeah, it's already pretty much impossible to get this particular check to be too
reliable, and sounds like it might get even more so in the future.  Anyway, I
think changing the regexp is an improvement right now, so done upstream:
http://rpmlint.zarb.org/cgi-bin/trac.cgi/changeset/1338

Comment 6 Fedora Update System 2007-09-07 17:21:32 UTC
rpmlint-0.81-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.