]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
fireinfo: Import upstream fixes
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 9 Sep 2015 14:32:09 +0000 (15:32 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 9 Sep 2015 14:32:09 +0000 (15:32 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/fireinfo
src/patches/fireinfo/0001-Add-an-other-forbidden-string-Serial.patch [moved from src/patches/fireinfo-Add-an-other-forbidden-string-Serial.patch with 90% similarity]
src/patches/fireinfo/0002-Escape-any-non-printable-ascii-characters.patch [new file with mode: 0644]
src/patches/fireinfo/0003-Skip-search-for-hypervisor-name-when-the-CPU-string-.patch [moved from src/patches/fireinfo-Skip-search-for-hypervisor-name-when-the-CPU-string-.patch with 90% similarity]
src/patches/fireinfo/0004-Filter-all-IDs-that-only-consist-of-0xff.patch [moved from src/patches/fireinfo/0001-Filter-all-IDs-that-only-consist-of-0xff.patch with 86% similarity]
src/patches/fireinfo/0005-Fix-crash-if-there-is-id-has-already-been-reset-to-N.patch [new file with mode: 0644]

index eae6c998565ad2500a59a12337e9549512d5114d..55a78455c04b1ab5e708ea295deffb5999051a26 100644 (file)
@@ -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
similarity index 90%
rename from src/patches/fireinfo-Add-an-other-forbidden-string-Serial.patch
rename to src/patches/fireinfo/0001-Add-an-other-forbidden-string-Serial.patch
index d7108520d47af120ed47c538aba701c535f101d7..00c983809fb303b52ca1e62a79395c5ab125f9a9 100644 (file)
@@ -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
 
diff --git a/src/patches/fireinfo/0002-Escape-any-non-printable-ascii-characters.patch b/src/patches/fireinfo/0002-Escape-any-non-printable-ascii-characters.patch
new file mode 100644 (file)
index 0000000..576154b
--- /dev/null
@@ -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
+
similarity index 90%
rename from src/patches/fireinfo-Skip-search-for-hypervisor-name-when-the-CPU-string-.patch
rename to src/patches/fireinfo/0003-Skip-search-for-hypervisor-name-when-the-CPU-string-.patch
index 24a8ca10ffff02a88b3ad07682639b293820de43..f64325117a0139e4ab5666bd758eb230666d4c40 100644 (file)
@@ -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
 
similarity index 86%
rename from src/patches/fireinfo/0001-Filter-all-IDs-that-only-consist-of-0xff.patch
rename to src/patches/fireinfo/0004-Filter-all-IDs-that-only-consist-of-0xff.patch
index 0c6fe4305cecf55114b5affcd8a2d5dca62c5b6e..737a319c59e7e56bfe93b6b1fd29ac0710972c19 100644 (file)
@@ -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):
diff --git a/src/patches/fireinfo/0005-Fix-crash-if-there-is-id-has-already-been-reset-to-N.patch b/src/patches/fireinfo/0005-Fix-crash-if-there-is-id-has-already-been-reset-to-N.patch
new file mode 100644 (file)
index 0000000..dcc552d
--- /dev/null
@@ -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
+