mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
fireinfo: Import upstream fixes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -70,9 +70,11 @@ $(subst %,%_MD5,$(objects)) :
|
||||
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
@$(PREBUILD)
|
||||
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo-Add-an-other-forbidden-string-Serial.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo-Skip-search-for-hypervisor-name-when-the-CPU-string-.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo/0001-Filter-all-IDs-that-only-consist-of-0xff.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo/0001-Add-an-other-forbidden-string-Serial.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo/0002-Escape-any-non-printable-ascii-characters.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo/0003-Skip-search-for-hypervisor-name-when-the-CPU-string-.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo/0004-Filter-all-IDs-that-only-consist-of-0xff.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo/0005-Fix-crash-if-there-is-id-has-already-been-reset-to-N.patch
|
||||
|
||||
cd $(DIR_APP) && [ -x "configure" ] || sh ./autogen.sh
|
||||
cd $(DIR_APP) && ./configure --prefix=/usr
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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] Add an other forbidden string: "Serial"
|
||||
Subject: [PATCH 1/5] Add an other forbidden string: "Serial"
|
||||
|
||||
---
|
||||
src/fireinfo/system.py | 2 +-
|
||||
@@ -21,5 +21,5 @@ index daf77b399d20..9d7872822b85 100644
|
||||
"01010101-0101-0101-0101-010101010101",
|
||||
"00020003-0004-0005-0006-000700080009",
|
||||
--
|
||||
2.1.0
|
||||
2.4.3
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
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,7 +1,8 @@
|
||||
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] Skip search for hypervisor name when the CPU string is empty
|
||||
Subject: [PATCH 3/5] Skip search for hypervisor name when the CPU string is
|
||||
empty
|
||||
|
||||
---
|
||||
src/_fireinfo/fireinfo.c | 11 ++++++-----
|
||||
@@ -30,5 +31,5 @@ index fc639d9d4cd9..6601c21a733f 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.1.0
|
||||
2.4.3
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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] Filter all IDs that only consist of 0xff
|
||||
Subject: [PATCH 4/5] Filter all IDs that only consist of 0xff
|
||||
|
||||
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
|
||||
---
|
||||
@@ -9,7 +9,7 @@ Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py
|
||||
index 4148c66..edf7359 100644
|
||||
index 4148c66eded7..edf7359a17e6 100644
|
||||
--- a/src/fireinfo/system.py
|
||||
+++ b/src/fireinfo/system.py
|
||||
@@ -255,6 +255,10 @@ class System(object):
|
||||
@@ -0,0 +1,26 @@
|
||||
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