Closed Bug 1599744 Opened 7 months ago Closed 7 months ago

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox-esr68 unaffected, firefox71 unaffected, firefox72 fixed)

RESOLVED FIXED
mozilla72
Tracking Status
firefox-esr68 --- unaffected
firefox71 --- unaffected
firefox72 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Configure fails tody with:

 0:00.44 /usr/bin/gmake -f client.mk -s configure
 0:00.45 cd /home/emilio/src/moz/gecko/obj-debug-static-analysis
 0:00.45 /home/emilio/src/moz/gecko/configure
 0:00.59 Creating Python 2 environment
 0:00.59 Traceback (most recent call last):
 0:00.59   File "/home/emilio/src/moz/gecko/configure.py", line 170, in <module>
 0:00.59     sys.exit(main(sys.argv))
 0:00.59   File "/home/emilio/src/moz/gecko/configure.py", line 46, in main
 0:00.59     sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure'))
 0:00.59   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 446, in run
 0:00.60     self.include_file(path)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 437, in include_file
 0:00.60     exec_(code, self)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/util.py", line 51, in exec_
 0:00.60     exec(object, globals, locals)
 0:00.60   File "/home/emilio/src/moz/gecko/moz.configure", line 7, in <module>
 0:00.60     include('build/moz.configure/init.configure')
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 769, in include_impl
 0:00.60     self.include_file(what)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 437, in include_file
 0:00.60     exec_(code, self)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/util.py", line 51, in exec_
 0:00.60     exec(object, globals, locals)
 0:00.60   File "/home/emilio/src/moz/gecko/build/moz.configure/init.configure", line 213, in <module>
 0:00.60     @imports(_from='mozbuild.virtualenv', _import='PY2')
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 752, in decorator
 0:00.60     depends = DependsFunction(self, func, dependencies, when=when)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 129, in __init__
 0:00.60     sandbox._value_for(self)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 543, in _value_for
 0:00.60     return self._value_for_depends(obj)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/util.py", line 997, in method_call
 0:00.60     cache[args] = self.func(instance, *args)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 552, in _value_for_depends
 0:00.60     value = obj.result()
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/util.py", line 997, in method_call
 0:00.60     cache[args] = self.func(instance, *args)
 0:00.60   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 155, in result
 0:00.61     return self._func(*resolved_args)
 0:00.61   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/configure/__init__.py", line 1152, in wrapped
 0:00.61     return new_func(*args, **kwargs)
 0:00.61   File "/home/emilio/src/moz/gecko/build/moz.configure/init.configure", line 279, in virtualenv_python2
 0:00.61     manager.build(python)
 0:00.61   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/virtualenv.py", line 493, in build
 0:00.61     self.create(python)
 0:00.61   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/virtualenv.py", line 228, in create
 0:00.61     env=ensure_subprocess_env(os.environ))
 0:00.61   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/virtualenv.py", line 727, in ensure_subprocess_env
 0:00.61     return {ensure(k, encoding): ensure(v, encoding) for k, v in env.iteritems()}
 0:00.61   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/virtualenv.py", line 727, in <dictcomp>
 0:00.61     return {ensure(k, encoding): ensure(v, encoding) for k, v in env.iteritems()}
 0:00.61   File "/home/emilio/src/moz/gecko/python/mozbuild/mozbuild/virtualenv.py", line 715, in ensure_bytes
 0:00.61     return value.encode(encoding)
 0:00.61 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

This is because my $PROMPT has non-ascii characters, but it's a really recent regression.

Manual bisecting shows this is a regression from bug 1590745.

Flags: needinfo?(mars)
Regressed by: 1590745

Unclear if this is the right thing to do, but this works for me and this is
python2 code only.

Assignee: nobody → emilio

Minimal repro is:

$ python2
value = "╭"
value.encode('utf-8')

I'm looking into it.

A second repo:

$ ./mach clobber
$ env PROMPT=╭ ./mach configure
Flags: needinfo?(mars)

Is it possible to write a test to make sure it won't happen again?

Ensure that environment variables with unicode values are handled correctly
when setting up a virtualenv.

Attachment #9111934 - Attachment is obsolete: true
Pushed by mfogels@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cac335eb3140
Ensure unicode env vars are handled by virtualenv r=ahal
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.