aboutsummaryrefslogtreecommitdiff
path: root/package/htop
diff options
context:
space:
mode:
authorGravatar Romain Naour <romain.naour@gmail.com>2018-03-18 22:26:44 +0100
committerGravatar Peter Korsgaard <peter@korsgaard.com>2018-03-19 13:22:49 +0100
commit16623babdd045374b97ccbca1fe1d61596cfe3bd (patch)
tree147451b3f1f3aadcec51447074d3484699ec33f7 /package/htop
parent398747f5fafca8c07e696612d8eded53d4f935c7 (diff)
downloadbuildroot-16623babdd045374b97ccbca1fe1d61596cfe3bd.tar.gz
buildroot-16623babdd045374b97ccbca1fe1d61596cfe3bd.tar.bz2
package/htop: open files using binary mode
Imlement Arnout's suggestion [1] for MakeHeader script. [1] http://lists.busybox.net/pipermail/buildroot/2018-February/214373.html Fixes: http://autobuild.buildroot.net/results/9ce/9ce2ef5ef694253b9759016c9702c5c6be7849a1 Signed-off-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'package/htop')
-rw-r--r--package/htop/0002-MakeHeader-open-files-using-binary-mode.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/package/htop/0002-MakeHeader-open-files-using-binary-mode.patch b/package/htop/0002-MakeHeader-open-files-using-binary-mode.patch
new file mode 100644
index 0000000000..bcc3e6564c
--- /dev/null
+++ b/package/htop/0002-MakeHeader-open-files-using-binary-mode.patch
@@ -0,0 +1,50 @@
+From 1a83a3e6ae0841a0dc4c7eb08a1a71930e99666c Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 18 Mar 2018 21:57:54 +0100
+Subject: [PATCH] MakeHeader: open files using binary mode
+
+By default, open(sys.argv[1]) use Unicode mode.
+The readlines() will try to convert with the default codec
+(which depends on the i18n settings, so 'ascii' under
+LC_ALL=C)
+
+Open files using binary mode so no conversion will be done
+by readlines(). But then, normal strings can't be used in
+the rest of the code; either all strings have to be prefixed
+with b'' or (simpler) the read line has to be converted to
+a unicode string by calling decode() on it.
+
+http://lists.busybox.net/pipermail/buildroot/2018-February/214373.html
+
+Fixes:
+http://autobuild.buildroot.net/results/9ce/9ce2ef5ef694253b9759016c9702c5c6be7849a1
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ scripts/MakeHeader.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/MakeHeader.py b/scripts/MakeHeader.py
+index 4841bda..dd0798c 100755
+--- a/scripts/MakeHeader.py
++++ b/scripts/MakeHeader.py
+@@ -16,7 +16,7 @@ SKIPONE=4
+ state = ANY
+ static = 0
+
+-file = open(sys.argv[1])
++file = open(sys.argv[1], 'rb')
+ name = sys.argv[1][:-2]
+
+ out = StringIO()
+@@ -31,6 +31,7 @@ out.write( "#define HEADER_" + os.path.basename(name) + "\n")
+ is_blank = False
+ for line in file.readlines():
+ line = line[:-1]
++ line = line.decode('utf-8')
+ if state == ANY:
+ if line == '/*{':
+ state = COPY
+--
+2.14.3
+