Bug 1298565 - Do not decode preprocessor output as ASCII r=glandium
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Tue, 30 Aug 2016 18:47:28 +0900
changeset 344651 6fe90a668d040b5463e2fe730783a412365d3757
parent 344650 c7e88c3a55411715489671c64d76049fca937862
child 344652 2320bcd12315f543b46ea2fb9a41d1fe202fae0d
push id8
push userfmarier@mozilla.com
push dateThu, 15 Sep 2016 05:23:20 +0000
reviewersglandium
bugs1298565
milestone51.0a1
Bug 1298565 - Do not decode preprocessor output as ASCII r=glandium MozReview-Commit-ID: BmXVO4KHRR2
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -269,19 +269,21 @@ def get_compiler_info(compiler, language
     ''')
 
     result = try_preprocess(compiler, language, check)
 
     if not result:
         raise FatalCheckError(
             'Unknown compiler or compiler not supported.')
 
+    # Metadata emitted by preprocessors such as GCC with LANG=ja_JP.utf-8 may
+    # have non-ASCII characters. Treat the output as bytearray.
     data = {}
     for line in result.splitlines():
-        if line.startswith('%'):
+        if line.startswith(b'%'):
             k, _, v = line.partition(' ')
             k = k.lstrip('%')
             data[k] = v.replace(' ', '').lstrip('"').rstrip('"')
             log.debug('%s = %s', k, data[k])
 
     try:
         type = CompilerType(data['COMPILER'])
     except: