Issue #4466 has been updated by MaxiM Basunov.
These errors leads to reporting strings to stderr while running Puppet via cron.
Could not retrieve selinux: Invalid argument - /proc/self/attr/current
Could not retrieve selinux: Invalid argument - /proc/self/attr/current
Could not retrieve selinux: Invalid argument - /proc/self/attr/current
Could not retrieve selinux: Invalid argument - /proc/self/attr/current
Could not retrieve selinux: Invalid argument - /proc/self/attr/current
Could not retrieve selinux: Invalid argument - /proc/self/attr/current
Could not retrieve selinux: Invalid argument - /proc/self/attr/current
Some information from host and tests:
# uname -a
Linux server.lid-info.com 2.6.18-194.17.4.el5 #1 SMP Mon Oct 25 15:50:53
EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
CentOS release 5.5 (Final)
# sestatus
SELinux status: disabled
# cat /proc/self/attr/current
cat: /proc/self/attr/current: Invalid argument
irb(main):001:0> File.read("/proc/self/attr/current")
Errno::EINVAL: Invalid argument - /proc/self/attr/current
from (irb):2:in `read'
from (irb):2
from :0
irb(main):001:0> %x{ /bin/cat /proc/self/attr/current }
/bin/cat: /proc/self/attr/current: Invalid argument
=> ""
So, any stderr should be ceased.
----------------------------------------
Bug #4466: Files in /proc should not be read directly by Ruby
https://projects.puppetlabs.com/issues/4466
Author: Rein Henrichs
Status: Accepted
Priority: Normal
Assignee:
Category:
Target version:
Keywords:
Branch:
Per a thread on the dev mailing list, Ruby reads files in /proc unreliably. The
current solution in some places is to use `/bin/cat`, for example `%x{ /bin/cat
/proc/uptime }`, instead of using `File.read` or variants. We should make sure
files in /proc are never read by Ruby directly.
>From Paul Berry:
> Correct me if I'm wrong, but it looks like the core problem is that reading
> from /proc files directly in Ruby is unreliable, because those files don't
> always respond to select() calls the way the Ruby interpreter expects.
> Sadly, the Linux kernel maintainers don't appear to have any intention of
> fixing this behavior (https://bugzilla.kernel.org/show_bug.cgi?id=11014), so
> we're stuck with it.
>
> There are other places in Facter that read directly from /proc. We should
> probably fix them too:
>
> ./lib/facter/processor.rb:14: File.readlines("/proc/cpuinfo").each do
> |l|
> ./lib/facter/selinux.rb:11: if (File.read("/proc/self/attr/current")
> != "kernel\0")
> ./lib/facter/util/ip.rb:135: bondinfo =
> IO.readlines("/proc/net/bonding/#{bonddev}")
> ./lib/facter/util/memory.rb:23: File.readlines("/proc/meminfo").each do
> |l|
> ./lib/facter/util/virtual.rb:24: txt = File.read("/proc/self/status")
> ./lib/facter/util/virtual.rb:47: txt = File.read("/proc/cpuinfo")
> ./lib/facter/util/vlans.rb:7: output =
> File.open('/proc/net/vlan/config').read
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.