python,util: Fixed string decoding in include verifier
authorBobby R. Bruce <bbruce@ucdavis.edu>
Tue, 16 Jun 2020 18:00:19 +0000 (11:00 -0700)
committerBobby R. Bruce <bbruce@ucdavis.edu>
Thu, 25 Jun 2020 23:48:10 +0000 (23:48 +0000)
The Python2 <-> Python3 port included a decode on a string as part of
the include statement git-hook verifier. This results in a failure. To
fix this issue, the file to be checked is opened in binary mode.

This issue was highlighted by Gabe Black here:
https://gem5-review.googlesource.com/c/public/gem5/+/28588

Change-Id: I9a30ecc24d4741853ed1c2d0c03addf57c3e5b6c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30336
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
util/style/verifiers.py

index 00cf0705ca2e78bd816f3a9fadd7c8a150fc58d7..85f31cee163e196fb3cef0f113ac820c21185a27 100644 (file)
@@ -347,7 +347,7 @@ class SortedIncludes(Verifier):
     def check(self, filename, regions=all_regions, fobj=None, silent=False):
         close = False
         if fobj is None:
-            fobj = self.open(filename, 'r')
+            fobj = self.open(filename, 'rb')
             close = True
         norm_fname = self.normalize_filename(filename)