Closed Bug 1056859 Opened 10 years ago Closed 5 years ago

UnicodeDecodeError in JarWriter when FileRegistry contains unicode strings

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: ahal, Unassigned)

Details

Attachments

(1 file)

Attached file Minimal test case
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1051809#c14

After some debugging I discovered this was because I was using MozbuildObject.topobjdir as the FileFinder basedir which is unicode. Casting it to str() first fixed the issue.

The attached test case fails. Removing the 'unicode_literals' import makes it work.
Yay for unicode_literals catching valid string handling bugs!

You should u.encode('utf-8') instead of str(u), where u is a unicode type.
Product: Core → Firefox Build System

There was a comment mentioning this bug in /python/mozbuild/mozbuild/codecoverage/packager.py
The comment was removed in bug 1605264 and that file now imports unicode_literals.
Is this still valid?

Flags: needinfo?(ahal)

I'm not sure, but probably not. I have no recollection of this issue and seeing as it is 5 years old, let's file a new one if it comes up again.

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(ahal)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: