Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1271326

Summary: "setfiles" finishes normally when giving a non-existing pathname.
Product: Red Hat Enterprise Linux 7 Reporter: Dalibor Pospíšil <dapospis>
Component: policycoreutilsAssignee: Petr Lautrbach <plautrba>
Status: CLOSED CURRENTRELEASE QA Contact: Dalibor Pospíšil <dapospis>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dwalsh, lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1086572 Environment:
Last Closed: 2017-03-30 07:00: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:
Embargoed:

Description Dalibor Pospíšil 2015-10-13 16:12:30 UTC
+++ This bug was initially created as a clone of Bug #1086572 +++

Customer Contact Name:
  Yasuyuki Kobayashi

Description of Problem:
  The man page of "setfiles" shows as the following.
  ----------
  setfiles [-c policy] [-d] [-l] [-n] [-e directory] [-o filename] [-q] [-s] [-v] [-vv] [-W] [-F] spec_file pathname...
  ----------
  
  Therefore, we expected that "setfiles" outputs error message and return non-zero value when giving a non-existing pathname.
  However, "setfiles" outputted no error message and returned 0.
  ----------
  # ls /tmp/dir_not_exist
  ls: cannot access /tmp/dir_not_exist: No such file or directory
  # cat spec_file 
  /tmp/dir_not_exist/file -- system_u:object_r:etc_t:s0
  # setfiles spec_file /tmp/dir_not_exist
  # echo $?
  0
  ----------
  
  Please fix "setfiles" to output error message and return non-zero value when pathname does not exist.
  
Version-Release number of selected component:
policycoreutils-2.2.5-15.el7

How reproducible:
  Always

Step to Reproduce:
1. see linked test

Comment 3 Petr Lautrbach 2017-03-30 07:00:50 UTC
# setfiles spec_file /tmp/dir_not_exist
setfiles:  lstat(/tmp/dir_not_exist) failed:  No such file or directory

# rpm -qf /usr/sbin/setfiles 
policycoreutils-2.5-14.el7.2.x86_64