mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 19:00:34 +02:00
fireinfo: Update to 2.1.12
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
From edacae4b2cdc41f1c0bfc93e041532ff6c49f60c Mon Sep 17 00:00:00 2001
|
||||
From: Michael Tremer <michael.tremer@ipfire.org>
|
||||
Date: Tue, 17 Mar 2015 22:19:17 +0100
|
||||
Subject: [PATCH 1/5] Add an other forbidden string: "Serial"
|
||||
|
||||
---
|
||||
src/fireinfo/system.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py
|
||||
index daf77b399d20..9d7872822b85 100644
|
||||
--- a/src/fireinfo/system.py
|
||||
+++ b/src/fireinfo/system.py
|
||||
@@ -45,7 +45,7 @@ INVALID_ID_STRINGS = (
|
||||
"EVAL",
|
||||
"Not Applicable",
|
||||
"None", "empty",
|
||||
- "System Serial Number",
|
||||
+ "Serial", "System Serial Number",
|
||||
"XXXXX",
|
||||
"01010101-0101-0101-0101-010101010101",
|
||||
"00020003-0004-0005-0006-000700080009",
|
||||
--
|
||||
2.4.3
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
From 4468fb2eb49e21d2350f6619584e6816f5159d29 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Tremer <michael.tremer@ipfire.org>
|
||||
Date: Sat, 28 Mar 2015 13:17:57 +0100
|
||||
Subject: [PATCH 2/5] Escape any non-printable ascii characters
|
||||
|
||||
http://forum.ipfire.org/viewtopic.php?f=5&t=12970
|
||||
---
|
||||
src/fireinfo/system.py | 18 ++++++++++++++----
|
||||
1 file changed, 14 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py
|
||||
index 9d7872822b85..4148c66eded7 100644
|
||||
--- a/src/fireinfo/system.py
|
||||
+++ b/src/fireinfo/system.py
|
||||
@@ -325,6 +325,16 @@ class System(object):
|
||||
|
||||
return v, m
|
||||
|
||||
+ @staticmethod
|
||||
+ def escape_string(s):
|
||||
+ """
|
||||
+ Will remove all non-printable characters from the given string
|
||||
+ """
|
||||
+ if s is None:
|
||||
+ return
|
||||
+
|
||||
+ return filter(lambda x: x in string.printable, s)
|
||||
+
|
||||
@property
|
||||
def vendor(self):
|
||||
"""
|
||||
@@ -334,14 +344,14 @@ class System(object):
|
||||
for file in ("sys_vendor", "board_vendor", "chassis_vendor",):
|
||||
ret = read_from_file(os.path.join(SYS_CLASS_DMI, file))
|
||||
if ret:
|
||||
- return ret
|
||||
+ return self.escape_string(ret)
|
||||
|
||||
if os.path.exists("/proc/device-tree"):
|
||||
ret = self.__cpuinfo.get("Hardware", None)
|
||||
else:
|
||||
ret, m = self.vendor_model_tuple()
|
||||
|
||||
- return ret
|
||||
+ return self.escape_string(ret)
|
||||
|
||||
@property
|
||||
def model(self):
|
||||
@@ -352,7 +362,7 @@ class System(object):
|
||||
for file in ("product_name", "board_model", "chassis_model",):
|
||||
ret = read_from_file(os.path.join(SYS_CLASS_DMI, file))
|
||||
if ret:
|
||||
- return ret
|
||||
+ return self.escape_string(ret)
|
||||
|
||||
# Read device-tree model if available
|
||||
ret = read_from_file("/proc/device-tree/model")
|
||||
@@ -364,7 +374,7 @@ class System(object):
|
||||
if not ret:
|
||||
v, ret = self.vendor_model_tuple()
|
||||
|
||||
- return ret
|
||||
+ return self.escape_string(ret)
|
||||
|
||||
@property
|
||||
def memory(self):
|
||||
--
|
||||
2.4.3
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From c667589410912ca980a78f417e86dd6585d58f9a Mon Sep 17 00:00:00 2001
|
||||
From: Michael Tremer <michael.tremer@ipfire.org>
|
||||
Date: Mon, 4 May 2015 16:00:31 +0200
|
||||
Subject: [PATCH 3/5] Skip search for hypervisor name when the CPU string is
|
||||
empty
|
||||
|
||||
---
|
||||
src/_fireinfo/fireinfo.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/_fireinfo/fireinfo.c b/src/_fireinfo/fireinfo.c
|
||||
index fc639d9d4cd9..6601c21a733f 100644
|
||||
--- a/src/_fireinfo/fireinfo.c
|
||||
+++ b/src/_fireinfo/fireinfo.c
|
||||
@@ -156,11 +156,12 @@ int detect_hypervisor(int *hypervisor) {
|
||||
|
||||
*hypervisor = HYPER_OTHER;
|
||||
|
||||
- int id;
|
||||
- for (id = HYPER_NONE + 1; id < HYPER_LAST; id++) {
|
||||
- if (strcmp(hypervisor_ids[id], sig.text) == 0) {
|
||||
- *hypervisor = id;
|
||||
- break;
|
||||
+ if (*sig.text) {
|
||||
+ for (int id = HYPER_NONE + 1; id < HYPER_LAST; id++) {
|
||||
+ if (strcmp(hypervisor_ids[id], sig.text) == 0) {
|
||||
+ *hypervisor = id;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.4.3
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From d58f8ef75a29dd6f8968084b5383ce0f39c75666 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Tremer <michael.tremer@ipfire.org>
|
||||
Date: Wed, 12 Aug 2015 10:50:42 +0100
|
||||
Subject: [PATCH 4/5] Filter all IDs that only consist of 0xff
|
||||
|
||||
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
|
||||
---
|
||||
src/fireinfo/system.py | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py
|
||||
index 4148c66eded7..edf7359a17e6 100644
|
||||
--- a/src/fireinfo/system.py
|
||||
+++ b/src/fireinfo/system.py
|
||||
@@ -255,6 +255,10 @@ class System(object):
|
||||
id = None
|
||||
break
|
||||
|
||||
+ # Check if the string only contains 0xff
|
||||
+ if all((e == "\xff" for e in id)):
|
||||
+ id = None
|
||||
+
|
||||
if id:
|
||||
_ids.append(id)
|
||||
|
||||
--
|
||||
2.4.3
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From deafec982e4c8f2e6ffa3bf70b0a94fa30158e9a Mon Sep 17 00:00:00 2001
|
||||
From: Michael Tremer <michael.tremer@ipfire.org>
|
||||
Date: Wed, 9 Sep 2015 15:04:43 +0100
|
||||
Subject: [PATCH 5/5] Fix crash if there is id has already been reset to None
|
||||
|
||||
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
|
||||
---
|
||||
src/fireinfo/system.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py
|
||||
index edf7359a17e6..c2ba12e818f0 100644
|
||||
--- a/src/fireinfo/system.py
|
||||
+++ b/src/fireinfo/system.py
|
||||
@@ -256,7 +256,7 @@ class System(object):
|
||||
break
|
||||
|
||||
# Check if the string only contains 0xff
|
||||
- if all((e == "\xff" for e in id)):
|
||||
+ if id and all((e == "\xff" for e in id)):
|
||||
id = None
|
||||
|
||||
if id:
|
||||
--
|
||||
2.4.3
|
||||
|
||||
Reference in New Issue
Block a user