Closed Bug 1630502 Opened 5 years ago Closed 5 years ago

vendor_rust.py doesn't declare an encoding when opening license file, causing failure of "UnicodeDecodeError: 'charmap' codec can't decode byte 0x81..."

Categories

(Firefox Build System :: General, defect)

All
Windows
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1631063

People

(Reporter: markh, Assigned: markh)

References

(Blocks 1 open bug)

Details

Attachments

(1 obsolete file)

No encoding is specified when opening Cargo.toml files to determine the licence, which means that locale.getpreferredencoding(False) is used. On Windows, this is likely to return 'cp1252'. As the license files are typically utf-8, any Cargo.toml files with non-ascii are going to throw this error. gecko/third_party/rust/bindgen/Cargo.toml has non-ascii in the authors line.

Full traceback:

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

  File "c:\src\moz\gecko\python/mozbuild/mozbuild/mach_commands.py", line 1336, in vendor_rust
    vendor_command.vendor(**kwargs)
  File "c:\src\moz\gecko\python/mozbuild\mozbuild\vendor_rust.py", line 432, in vendor
    if not self._check_licenses(vendor_dir):
  File "c:\src\moz\gecko\python/mozbuild\mozbuild\vendor_rust.py", line 343, in _check_licenses
    results = [check_package(p) for p in os.listdir(vendor_dir)
  File "c:\src\moz\gecko\python/mozbuild\mozbuild\vendor_rust.py", line 344, in <listcomp>
    if os.path.isdir(os.path.join(vendor_dir, p))]
  File "c:\src\moz\gecko\python/mozbuild\mozbuild\vendor_rust.py", line 286, in check_package
    license_lines = [l for l in f if l.strip().startswith('license')]
  File "c:\src\moz\gecko\python/mozbuild\mozbuild\vendor_rust.py", line 286, in <listcomp>
    license_lines = [l for l in f if l.strip().startswith('license')]
  File "c:\mozilla-build\python3\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
Blocks: mach-busted
Attachment #9140941 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: