1 |
dev-zero 13/05/31 08:52:05 |
2 |
|
3 |
Added: facter-1.7.1-fix-proc-self-status.patch |
4 |
Log: |
5 |
Version bump to 1.7.1, add pciutils USE flag to make it possible to disable that dependency on vservers. |
6 |
|
7 |
(Portage version: 2.1.11.63/cvs/Linux x86_64, signed Manifest commit with key 0x1E0CA85F!) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-ruby/facter/files/facter-1.7.1-fix-proc-self-status.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-ruby/facter/files/facter-1.7.1-fix-proc-self-status.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-ruby/facter/files/facter-1.7.1-fix-proc-self-status.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: facter-1.7.1-fix-proc-self-status.patch |
16 |
=================================================================== |
17 |
From d54c86abfba35f48cad78bb99b1d199afe8c2095 Mon Sep 17 00:00:00 2001 |
18 |
From: Jeff McCune <jeff@××××××××××.com> |
19 |
Date: Tue, 16 Apr 2013 11:27:30 -0400 |
20 |
Subject: [PATCH] (#14522) Force /proc/self/status encoding to valid UTF-8 (try |
21 |
2) |
22 |
|
23 |
Without this patch the previous attempt to fix issue 14522 is |
24 |
insufficient because the String#encode method is a no-op when the source |
25 |
and destination encodings are the same encoding, even if there are |
26 |
invalid byte sequences. |
27 |
|
28 |
This is a problem because we're still getting unhandled `invalid byte |
29 |
sequence in UTF-8` errors running the specs. |
30 |
|
31 |
This patch addresses the problem by changing encoding from UTF-8 to |
32 |
UTF-16, replacing all invalid byte sequences with the default unicode |
33 |
string of "uFFFD" We then convert back to UTF-8 to guarantee only valid |
34 |
byte sequences remain. |
35 |
--- |
36 |
lib/facter/util/virtual.rb | 3 ++- |
37 |
1 file changed, 2 insertions(+), 1 deletion(-) |
38 |
|
39 |
diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb |
40 |
index 8223b41..65cf58a 100644 |
41 |
--- a/lib/facter/util/virtual.rb |
42 |
+++ b/lib/facter/util/virtual.rb |
43 |
@@ -63,7 +63,8 @@ def self.vserver? |
44 |
return false unless FileTest.exists?("/proc/self/status") |
45 |
txt = File.open("/proc/self/status", "rb").read |
46 |
if txt.respond_to?(:encode!) |
47 |
- txt.encode!('UTF-8', 'UTF-8', :invalid => :replace) |
48 |
+ txt.encode!('UTF-16', 'UTF-8', :invalid => :replace) |
49 |
+ txt.encode!('UTF-8', 'UTF-16') |
50 |
end |
51 |
return true if txt =~ /^(s_context|VxID):[[:blank:]]*[0-9]/ |
52 |
return false |
53 |
-- |
54 |
1.8.1.6 |