]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Use binary mode when compressing data
authorSimon Glass <sjg@chromium.org>
Tue, 14 May 2019 21:53:45 +0000 (15:53 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 10 Jul 2019 22:52:58 +0000 (16:52 -0600)
The lz4 utility inserts binary data in its output which cannot always be
converted to unicode (nor should it be). Fix this by using the new binary
mode for program output.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/etype/blob.py
tools/binman/ftest.py

index ae80bbee530c72b51d438eebb9901714d4b5480e..f56a1f876886ccf854ca60c7b680278a085573b8 100644 (file)
@@ -60,7 +60,7 @@ class Entry_blob(Entry):
             except AttributeError:
                 data = lz4.compress(data)
             '''
-            data = tools.Run('lz4', '-c', self._pathname)
+            data = tools.Run('lz4', '-c', self._pathname, binary=True)
         self.SetContents(data)
         return True
 
index 1111852a4068d304f99cb7c1fd40ef3a171e6749..4d96933cb4d4b08fe15a45a884d541d403fbb7f9 100644 (file)
@@ -1557,7 +1557,7 @@ class TestFunctional(unittest.TestCase):
         out = os.path.join(self._indir, 'lz4.tmp')
         with open(out, 'wb') as fd:
             fd.write(data)
-        return tools.Run('lz4', '-dc', out)
+        return tools.Run('lz4', '-dc', out, binary=True)
         '''
         try:
             orig = lz4.frame.decompress(data)