Bug 1692676

Summary: Building a custom module prints a "syntax error near unexpected token" message
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: low    
Version: 8.0CC: lvrabec, mmalik, omosnace, plautrba, ssekidde, zpytela
Target Milestone: rc   
Target Release: 8.1   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-6.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:11:10 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:
Embargoed:
Bug Depends On: 1673107    
Bug Blocks:    

Description Renaud Métrich 2019-03-26 08:42:34 UTC
Description of problem:

The /usr/share/selinux/devel/include/Makefile directives contain a "find" which break when a file in the current directory has some special character such as a parenthesis.
This is cosmetic only, the module builds anyway.


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

selinux-policy-devel-3.14.1-61.el8.noarch and lower (RHEL 7 is affected also)


How reproducible:

Always


Steps to Reproduce:
1. Create a custom module

foo.te:

module foo 1.0;
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
require {
	class file entrypoint;
	type shell_exec_t;
	type vmtools_unconfined_t;
}

# Allow transitioning to unconfined when executing a shell
allow vmtools_unconfined_t shell_exec_t : file entrypoint;
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. Touch a file in current directory with a parenthesis

# touch "my broken (file)"

3. Build the module

# make -f /usr/share/selinux/devel/Makefile foo.pp


Actual results:

/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `find anaconda-ks.cfg my broken (file) vncserver.strace systemd.strace rhel-server-7.6-x86_64-boot.iso rt_minimal.c vnc.cil foo.te rsyslog tmp virt-install.log evil_banner.sh livemedia.log program.log foo.if rhel7-minimal.ks TestZip.java TestZip.class foo.fc sudoloop foo.pp strace.log -maxdepth 0 -type d'


Expected results:

No "syntax error"

Comment 4 Ondrej Mosnacek 2019-05-22 07:37:48 UTC
FYI, I sent pull requests to upstream refpolicy and Fedora policy that should fix this issue:
https://github.com/SELinuxProject/refpolicy/pull/53
https://github.com/fedora-selinux/selinux-policy/pull/265

Comment 9 errata-xmlrpc 2019-11-05 22:11:10 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://access.redhat.com/errata/RHBA-2019:3547