From 32044bbc456c7e360e2932675ffa55a112c10ab0 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 22 Aug 2019 17:02:39 +0000 Subject: [PATCH] Bug 1575804 - Don't decode the result from check_cmd_output. r=froydnj Bug 1575135 changed check_cmd_output to return unicode strings, but a couple places were already trying to do their own decoding, which now can fail. Remove those. Interesting the decoding was previously broken on Windows, this actually fixes it (the output of hg config is not actually utf-8 on Windows). Differential Revision: https://phabricator.services.mozilla.com/D43044 --HG-- extra : moz-landing-system : lando --- build/moz.configure/init.configure | 11 ----------- build/moz.configure/toolchain.configure | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index 108971a9e0e0..5b7f2515e48d 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -506,17 +506,6 @@ def hg_config(build_env, hg, version): # `hg version` worked. out = check_cmd_output(hg, 'config', env=env, cwd=build_env.topsrcdir) - # out is bytes. However, unicode literals are in effect, so implicit - # type coercion can occur. The underlying Mercurial config file may be - # in a user-defined encoding. However, HGPLAIN both overrides the decoding - # inside Mercurial *and* ensures output is utf-8. Because moz.configure - # is using unicode literals, our returned config object uses unicode - # keys and values to limit potential for coercion. - - # Mercurial should emit utf-8. But be paranoid and ignore invalid utf-8 - # byte sequences. - out = out.decode('utf-8', 'replace') - config = {} for line in out.strip().splitlines(): diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index fd12d182df38..db82e809ec74 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -2157,7 +2157,7 @@ def gnu_as(assembler, c_compiler, toolchain_flags): # close the stdin pipe. # clang will error if it uses its integrated assembler for this target, # so handle failures gracefully. - if 'GNU' in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: '').decode('utf-8'): + if 'GNU' in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: ''): return True