Bug 1325118

Summary: gedit doesn't respect change selinux file contexts on save
Product: [Fedora] Fedora Reporter: Rodd Clarkson <rodd>
Component: geditAssignee: Ray Strode [halfline] <rstrode>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: rstrode
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-29 11:54:28 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 Rodd Clarkson 2016-04-08 10:09:15 UTC
Description of problem:

If I change the context of a file (using `chcon -t [context] filename`) and then edit the file with gedit, the file changes back to it's original file context each save.
 

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

gedit-3.18.3-1.fc23.x86_64


How reproducible:

Very


Steps to Reproduce:
1. change the context of a file using chcon -t new_context filename

In my case this file is a cgi file in a folder in /var/www/html/x/

ls -lZ shows 

drwxr-xr-x. 6 rodd rodd unconfined_u:object_r:httpd_sys_content_t:s0      4096 Apr  8 20:01 .
-rwxr-xr-x. 1 rodd rodd unconfined_u:object_r:httpd_sys_script_exec_t:s0  9506 Jun  5  2015 rep_period.cgi

I've used 
chcon -t httpd_sys_script_exec_t rep_setup.cgi
to change the context so that the cgi file can run.

2. Edit the file using vi.

3. Check the context of the file using ls -lZ.  It should be the new context.

4. Edit the file using gedit (in effect, open it and then press CTRL-S) and save the file.

5. Check the context again with ls -lZ


Actual results:

The context of the file has changed back to the default for the directory, in my case 'httpd_sys_content_t'.  As a result the file will no longer work properly until the context required is restored.

Expected results:

The file context should remain the same, and the file should continue to work as expected.


Additional Information:

Comment 1 Fedora End Of Life 2016-11-25 07:17:48 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Fedora End Of Life 2016-12-20 19:52:21 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 3 Rodd Clarkson 2017-03-02 23:22:34 UTC
This is still a problem in Fedora 25, so I'm reopening this.

I can still edit the file in vi and it keeps the context, edit it in gedit an it clobbers the context.

It's easy enough to turn of enforcing, but it kind of goes against the principals of things just working right.

Comment 4 Rodd Clarkson 2017-07-27 01:37:11 UTC
This is still an issue in gedit-3.22

gedit should respect selinux contexts, instead of resetting them on change.

Comment 5 Fedora End Of Life 2018-05-03 08:42:28 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2018-05-29 11:54:28 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.