Closed Bug 1411994 Opened 7 years ago Closed 7 years ago

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 62: character maps to <undefined>

Categories

(Firefox Build System :: General, defect)

Unspecified
Windows
defect
Not set
normal

Tracking

(firefox58 fixed)

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: Paenglab, Assigned: gps)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached file error.log
I installed VS 2017 with the settings from wiki after I uninstalled VS 2015. When I build I get the error in the attached log.

Ted thinks, that that code wasn't prepared to handle the non-ascii output from my compiler.

python -c 'import locale; print locale.getpreferredencoding()' gives cp1252.

I'm using mozilla-build v3.0
Switched VS to English and now it's building. So it is a problem when it is set to German.
Attachment #8922361 - Attachment mime type: text/x-log → text/plain
I think I can code up a fix real quick...
Assignee: nobody → gps
Status: NEW → ASSIGNED
Comment on attachment 8922549 [details]
Bug 1411994 - Ignore Unicode errors when logging;

https://reviewboard.mozilla.org/r/193624/#review199876

One one end, this solves the bug as filed, on the other end, I'm thinking that LineIO is not necessarily the only way we can get such errors, and that the encoding that happens in LineIO should probably moved one layer down, to the log.* functions.

::: build/moz.configure/init.configure:190
(Diff revision 1)
>          elif 'PYTHON' in mozconfig['vars']['added']:
>              python = mozconfig['vars']['added']['PYTHON']
>          elif 'PYTHON' in mozconfig['vars']['modified']:
>              python = mozconfig['vars']['modified']['PYTHON'][1]
>  
> -    with LineIO(lambda l: log.error(l)) as out:
> +    with LineIO(lambda l: log.error(l), 'replace') as out:

verify_python_version is not going to write more than valid ascii, you can skip replace here.

::: build/moz.configure/rust.configure:193
(Diff revision 1)
>          out_fd, out_path = mkstemp(prefix='conftest', suffix='.rlib')
>          os.close(out_fd)
>          try:
>              source = 'pub extern fn hello() { println!("Hello world"); }'
>              log.debug('Creating `%s` with content:', in_path)
> -            with LineIO(lambda l: log.debug('| %s', l)) as out:
> +            with LineIO(lambda l: log.debug('| %s', l), 'replace') as out:

the written string is a controlled, unicode string. No need for replace.

::: build/moz.configure/util.configure:221
(Diff revision 1)
>      fd, path = mkstemp(prefix='conftest.', suffix=suffix)
>      try:
>          source = source.encode('ascii', 'replace')
>  
>          log.debug('Creating `%s` with content:', path)
> -        with LineIO(lambda l: log.debug('| %s', l)) as out:
> +        with LineIO(lambda l: log.debug('| %s', l), 'replace') as out:

see 2 lines above, the written buffer is the result of an encoding to ascii, so you don't need to further replace back.
Attachment #8922549 - Flags: review?(mh+mozilla) → review+
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6f9a71b5312b
Ignore Unicode errors when logging; r=glandium
Blocks: 1413239
https://hg.mozilla.org/mozilla-central/rev/6f9a71b5312b
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: