[build-path-prefix-map-spec] 01/01: Fix printing of multiline byte output, spotted by Gabriel Scherer

Ximin Luo infinity0 at debian.org
Mon Dec 4 14:52:22 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository build-path-prefix-map-spec.

commit 8d4ceed752d4f3a4ef6548bf1b7045c1c4fc464f
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Dec 4 15:51:29 2017 +0100

    Fix printing of multiline byte output, spotted by Gabriel Scherer
---
 consume/make_printable.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/consume/make_printable.py b/consume/make_printable.py
index b93a514..301c5f6 100755
--- a/consume/make_printable.py
+++ b/consume/make_printable.py
@@ -6,12 +6,14 @@ import textwrap
 
 sanitized = [x for x in string.printable if x not in string.whitespace or x in " \n"]
 
-contents = open(sys.argv[1], 'rb').read().rstrip(b'\n')
-try:
-    contents = contents.decode("utf-8")
-    if all(x in sanitized for x in contents):
-        print(contents)
-    else:
-        print("\u200b".join(repr(contents)))
-except UnicodeDecodeError:
-    print("".join(repr(contents)))
+contents = open(sys.argv[1], 'rb').readlines()
+for line in contents:
+    line = line.rstrip(b'\n')
+    try:
+        line = line.decode("utf-8")
+        if all(x in sanitized for x in line):
+            print(line)
+        else:
+            print("\u200b".join(repr(line)))
+    except UnicodeDecodeError:
+        print("".join(repr(line)))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/build-path-prefix-map-spec.git



More information about the Reproducible-commits mailing list