From 308662285eec7d72ef57b4037e756cb8dc35bc94 Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Fri, 1 Sep 2023 12:08:06 +0200 Subject: [PATCH] Strip null bytes in kmods fact, fixes #98 --- lib/facter/kmod.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/facter/kmod.rb b/lib/facter/kmod.rb index 8004fd4..e8e1a30 100644 --- a/lib/facter/kmod.rb +++ b/lib/facter/kmod.rb @@ -24,7 +24,7 @@ next unless File.readable?("/sys/module/#{directory}/parameters/#{param}") begin - kmod[directory]['parameters'][param] = File.read("/sys/module/#{directory}/parameters/#{param}").chomp + kmod[directory]['parameters'][param] = File.read("/sys/module/#{directory}/parameters/#{param}").chomp.delete("\u0000") rescue StandardError # some kernel parameters are write only # even though they have the read bit set