Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 595089 Details for
Bug 836313
Detects SELinux as being disabled/false
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Fix SELinux path detection, submitted for #15049
15049.patch (text/plain), 4.05 KB, created by
Dominic Cleal
on 2012-06-28 16:44:22 UTC
(
hide
)
Description:
Fix SELinux path detection, submitted for #15049
Filename:
MIME Type:
Creator:
Dominic Cleal
Created:
2012-06-28 16:44:22 UTC
Size:
4.05 KB
patch
obsolete
>commit 3c1c272c5a03ff5973bfaaa6005aa135e29c11d4 >Author: Dominic Cleal <dcleal@redhat.com> >Date: Thu Jun 28 13:00:44 2012 +0200 > > (#15049) Return only one selinuxfs path as string from mountinfo > > The block that parses /proc/self/mountinfo to find a selinuxfs filesystem would > return results as an array. On Ruby 1.8, interpolating this into a string for > File.exists? when one result was returned worked, while on Ruby 1.9 it > interpolated as ["/sys/fs/selinux"]/enforce so later failed. > > This changes the block to return the single result string rather than an array. > This also fixes #11531 where multiple selinuxfs filesystems could be mounted, > as it returns only the first mountpoint. > >diff --git a/lib/facter/selinux.rb b/lib/facter/selinux.rb >index 36f4b2f..ee928d2 100644 >--- a/lib/facter/selinux.rb >+++ b/lib/facter/selinux.rb >@@ -18,7 +18,7 @@ def selinux_mount_point > if FileTest.exists?('/proc/self/mountinfo') > File.open('/proc/self/mountinfo') do |f| > f.grep(/selinuxfs/) do |line| >- line.split[4] >+ return line.split[4] > end > end > else >diff --git a/spec/unit/selinux_spec.rb b/spec/unit/selinux_spec.rb >index 63313a7..4c3eb69 100755 >--- a/spec/unit/selinux_spec.rb >+++ b/spec/unit/selinux_spec.rb >@@ -9,17 +9,58 @@ describe "SELinux facts" do > Facter.clear > end > >- it "should return true if SELinux enabled" do >- Facter.fact(:kernel).stubs(:value).returns("Linux") >+ describe "should detect if SELinux is enabled" do >+ it "and return true with default /selinux" do >+ Facter.fact(:kernel).stubs(:value).returns("Linux") > >- FileTest.stubs(:exists?).returns false >- File.stubs(:read).with("/proc/self/attr/current").returns("notkernel") >+ FileTest.stubs(:exists?).returns false >+ File.stubs(:read).with("/proc/self/attr/current").returns("notkernel") > >- FileTest.expects(:exists?).with("/selinux/enforce").returns true >- FileTest.expects(:exists?).with("/proc/self/attr/current").returns true >- File.expects(:read).with("/proc/self/attr/current").returns("kernel") >+ FileTest.expects(:exists?).with("/selinux/enforce").returns true >+ FileTest.expects(:exists?).with("/proc/self/attr/current").returns true >+ File.expects(:read).with("/proc/self/attr/current").returns("kernel") >+ >+ Facter.fact(:selinux).value.should == "true" >+ end >+ >+ it "and return true with selinuxfs path from /proc" do >+ Facter.fact(:kernel).stubs(:value).returns("Linux") >+ >+ mountinfo = mock() >+ lines = [ "24 16 0:13 / /sys/fs/selinux rw,relatime - selinuxfs selinuxfs rw" ] >+ mountinfo.expects(:grep).multiple_yields(*lines) >+ >+ FileTest.expects(:exists?).with("/proc/self/mountinfo").returns true >+ File.expects(:open).with("/proc/self/mountinfo").yields(mountinfo) >+ >+ FileTest.expects(:exists?).with("/sys/fs/selinux/enforce").returns true >+ >+ FileTest.expects(:exists?).with("/proc/self/attr/current").returns true >+ File.expects(:read).with("/proc/self/attr/current").returns("kernel") >+ >+ Facter.fact(:selinux).value.should == "true" >+ end >+ >+ it "and return true with multiple selinuxfs mounts from /proc" do >+ Facter.fact(:kernel).stubs(:value).returns("Linux") >+ >+ mountinfo = mock() >+ lines = [ >+ "25 18 0:13 / /sys/fs/selinux rw,relatime - selinuxfs selinuxfs rw", >+ "61 57 0:13 / /var/tmp/imgcreate-R2wmE6/install_root/sys/fs/selinux rw,relatime shared:16 - selinuxfs selinuxfs rw" >+ ] >+ mountinfo.expects(:grep).multiple_yields(*lines) >+ >+ FileTest.expects(:exists?).with("/proc/self/mountinfo").returns true >+ File.expects(:open).with("/proc/self/mountinfo").yields(mountinfo) >+ >+ FileTest.expects(:exists?).with("/sys/fs/selinux/enforce").returns true >+ >+ FileTest.expects(:exists?).with("/proc/self/attr/current").returns true >+ File.expects(:read).with("/proc/self/attr/current").returns("kernel") > >- Facter.fact(:selinux).value.should == "true" >+ Facter.fact(:selinux).value.should == "true" >+ end > end > > it "should return true if SELinux policy enabled" do
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 836313
: 595089