]> git.baikalelectronics.ru Git - uboot.git/commit
patman: Convert byte arrays to strings
authorGeorge McCollister <george.mccollister@gmail.com>
Thu, 30 Mar 2017 14:44:24 +0000 (09:44 -0500)
committerSimon Glass <sjg@chromium.org>
Thu, 13 Apr 2017 17:43:49 +0000 (11:43 -0600)
commitf0a04d523c2f12a89aca6d51013933e022024008
tree762cc5ca496a8780ed826bed854fd07fdeb887c5
parent4e91029ffb8bde9ae1268311d6f6d7f1db05124f
patman: Convert byte arrays to strings

os.read() returns a byte array in Python 3.5.2 and needs to be converted
into a string. Check if the returned value is an instance of bytes and
if it is decode it as a utf-8 string. If it is not a utf-8 encoded string
the decoding may fail with an exception.

Prior to this fix the comparisions check data == "" would fail when data
was b'' and would cause an infinite memory leaking loop. joins would
also fail with an exception below but due to the infinite loop it never
made it that far.

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/patman/cros_subprocess.py