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 755939 - slip.util.files.overwrite_safely fails when SELinux is disabled
Summary: slip.util.files.overwrite_safely fails when SELinux is disabled
Keywords:
Status: CLOSED DUPLICATE of bug 720848
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-slip
Version: 6.1
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Nils Philippsen
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-22 13:24 UTC by Tru Huynh
Modified: 2011-12-09 09:44 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 627788
Environment:
Last Closed: 2011-12-09 09:44:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
CentOS 5250 0 None None None Never

Description Tru Huynh 2011-11-22 13:24:04 UTC
+++ This bug was initially created as a clone of Bug #627788 +++

Description of problem:
If SELinux is disabled, when slip.util.files.overwrite_safely is called with the default preserve_context=True, it fails because it cannot read the "security.selinux" xattr of the destination file.  This makes it impossible to save the configuration in system-config-date.

Version-Release number of selected component (if applicable):
python-slip-0.2.12-1.fc13.noarch

How reproducible:
Always

Steps to Reproduce:
touch foo
python <<SCRIPT
from slip.util.files import overwrite_safely
overwrite_safely("foo", "content")
SCRIPT
  
Actual results:
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/lib/python2.6/site-packages/slip/util/files.py", line 179, in overwrite_safely
    ret, ctx = selinux.getfilecon(path)
OSError: [Errno 61] No data available

Expected results:
The file is successfully written.

--- Additional comment from nphilipp on 2010-08-31 09:47:57 EDT ---

I seem to have misunderstood the possible return values of selinux.is_selinux_enabled():

commit 6502bebb6b94d613e84e2cc517a299e2cb9028c9
Author: Nils Philippsen <nils>
Date:   Tue Aug 31 15:43:30 2010 +0200

    fix overwrite_safely() if SELinux is disabled (#627788)

diff --git a/slip/util/files.py b/slip/util/files.py
index b248d17..1b2887d 100644
--- a/slip/util/files.py
+++ b/slip/util/files.py
@@ -165,7 +165,7 @@ def overwrite_safely(path, content, preserve_mode=True, preserve_context=True):
 
     exists = os.path.exists(path)
 
-    if preserve_context and selinux.is_selinux_enabled() < 0:
+    if preserve_context and selinux.is_selinux_enabled() <= 0:
         preserve_context = False
 
     try:

--- Additional comment from nphilipp on 2010-08-31 09:54:56 EDT ---

According to your comment on the Fedora update page:

 mattmccutchen  - 2010-08-27 00:44:12
I'm unable to test bug 615819 because bug 627788 prevents system-config-date from saving the configuration at all on my SELinux-disabled system. I tried downgrading to python-slip-0.2.11-1.fc13 and the same problem occurs, so it's not a regression; I'm not sure what changed since I initially filed bug 615819.

It may even be that something changed in libselinux/-python (but that doesn't really matter now).

--- Additional comment from updates on 2010-08-31 10:48:14 EDT ---

python-slip-0.2.13-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/python-slip-0.2.13-1.fc14

--- Additional comment from updates on 2010-08-31 10:48:21 EDT ---

python-slip-0.2.13-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/python-slip-0.2.13-1.fc13

--- Additional comment from updates on 2010-08-31 10:48:26 EDT ---

python-slip-0.2.13-1.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/python-slip-0.2.13-1.fc12

--- Additional comment from updates on 2010-08-31 23:30:19 EDT ---

python-slip-0.2.13-1.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update python-slip'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/python-slip-0.2.13-1.fc13

--- Additional comment from updates on 2010-09-02 16:37:42 EDT ---

python-slip-0.2.13-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

--- Additional comment from updates on 2010-10-01 08:25:06 EDT ---

python-slip-0.2.13-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

--- Additional comment from updates on 2010-10-08 16:39:15 EDT ---

python-slip-0.2.13-1.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 1 Tru Huynh 2011-11-22 13:24:36 UTC
python-slip-0.2.11-1.el6.noarchdoes have the issue

Comment 3 Nils Philippsen 2011-12-09 09:44:22 UTC

*** This bug has been marked as a duplicate of bug 720848 ***


Note You need to log in before you can comment on or make changes to this bug.