Bug 1329083

Summary: BUG: %check RPM macro used in libseccomp %changelog needs to be escaped
Product: Red Hat Enterprise Linux 7 Reporter: Kamil Dudka <kdudka>
Component: libseccompAssignee: Paul Moore <pmoore>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: chayang, huding, juzhang, virt-bugs, xfu
Target Milestone: rcKeywords: EasyFix
Target Release: 7.3   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libseccomp-2.3.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 03:29:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Kamil Dudka 2016-04-21 07:18:49 UTC
Description of problem:
The following change log entry contains unescaped RPM macro, which is not allowed:

* Tue Nov  5 2013 Paul Moore <pmoore> - 2.1.1-0
- New upstream version
- Added a %check procedure for self-test during build

%check should be spelled as %%check instead.


Version-Release number of selected component (if applicable):
libseccomp-2.3.1-0.el7


How reproducible:
Easily.


Steps to Reproduce:
1. rpmlint libseccomp.spec


Actual results:
libseccomp.spec:93: W: macro-in-%changelog %check


Additional info:
This causes problems to csmock (a tool for fully automatic static analysis of RPM packages).

Comment 2 Paul Moore 2016-04-21 14:52:27 UTC
Odd that this wasn't caught earlier, perhaps rpmlint gained some new capabilities?  Regardless, I'm fixing this now.

Comment 4 Paul Moore 2016-04-21 15:04:02 UTC
FWIW, I just fixed the same issue in Fedora Rawhide.

Comment 5 Kamil Dudka 2016-04-21 15:05:22 UTC
(In reply to Paul Moore from comment #2)
> Odd that this wasn't caught earlier, perhaps rpmlint gained some new
> capabilities?

For rpmlint it is just a warning but it causes problems to csmock, where we call rpmbuild with "--define" "check\\\n%%check\\\nexit 0" in order not to execute %check on RHEL-6, where the --nocheck option of rpmbuild does not exist yet:

https://git.fedorahosted.org/cgit/csmock.git/tree/py/csmock?id=bbf04636#n52

The build fails with "error: line 88: second %check".

> Regardless, I'm fixing this now.

Thanks!  This will help us to make future scans of libseccomp unattended.

Comment 7 Chao Yang 2016-08-30 05:54:55 UTC
Reproduced with libseccomp-2.3.1-0.el7.src.rpm.

Steps:
rpmlint -i libseccomp.spec

Actual Result:

libseccomp.spec:93: W: macro-in-%changelog %check
Macros are expanded in %changelog too, which can in unfortunate cases lead to
the package not building at all, or other subtle unexpected conditions that
affect the build.  Even when that doesn't happen, the expansion results in
possibly "rewriting history" on subsequent package revisions and generally odd
entries eg. in source rpms, which is rarely wanted.  Avoid use of macros in
%changelog altogether, or use two '%'s to escape them, like '%%foo'.



- Verified pass with libseccomp-2.3.1-2.el7.src.rpm. No such issue any more.

Comment 9 errata-xmlrpc 2016-11-04 03:29:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2310.html