Closed Bug 1628726 Opened 2 years ago Closed 2 years ago

Windows KeyError build failures in _emit_libs_derived with Python 3.8


(Firefox Build System :: General, defect)

Not set


(firefox-esr68 unaffected, firefox74 unaffected, firefox75 unaffected, firefox76 unaffected, firefox77 verified)

Tracking Status
firefox-esr68 --- unaffected
firefox74 --- unaffected
firefox75 --- unaffected
firefox76 --- unaffected
firefox77 --- verified


(Reporter: ryanvm, Assigned: saschanaz)




(Keywords: regression)


(2 files)

Local bisection is pointing at bug 1627163 as the culprit.

Traceback (most recent call last):
  File "c:/Users/Ryan/repos/mozilla/", line 181, in <module>
  File "c:/Users/Ryan/repos/mozilla/", line 57, in main
    return config_status(config)
  File "c:/Users/Ryan/repos/mozilla/", line 176, in config_status
    return config_status(args=[], **normalize(sanitized_config))
  File "c:\Users\Ryan\repos\mozilla\python\mozbuild\mozbuild\", line 145, in config_status
    definitions = list(definitions)
  File "c:\Users\Ryan\repos\mozilla\python\mozbuild\mozbuild\frontend\", line 193, in emit
    objs = list(self._emit_libs_derived(contexts))
  File "c:\Users\Ryan\repos\mozilla\python\mozbuild\mozbuild\frontend\", line 227, in _emit_libs_derived
    collection = cls(contexts[root])
KeyError: 'C:/Users/Ryan/repos/mozilla/objdir-clang/dom/bindings'

I'm using python 3.8.2 if that matters.

Out of curiosity, if you insert a print(contexts) right above that line, what are the contents of that dict? There's likely some easy fix we can do with path normalization here, but I don't know exactly what the issue is here and I can't reproduce the problem.

Flags: needinfo?(ryanvm)
Attached file Patch
Does this patch fix the issue for you? For the record I'd prefer to fix the problem at the source and just make sure that whenever we emit any paths, they're always normalized from the jump, but today's a bit too busy of a day for me to do the "correct" structural fix :)

Same error as before, except it's an upper-case C:/ now :(

KeyError: 'C:/Users/Ryan/repos/mozilla/objdir-clang/dom/bindings'

Flags: needinfo?(ryanvm)

We've isolated the issue to Python 3.8. Since 3.7 is the version we use in MozillaBuild I don't see this affecting many (or any) people before I'm able to put in a proper fix.

No longer blocks: mach-busted
Summary: Windows KeyError build failures in _emit_libs_derived → Windows KeyError build failures in _emit_libs_derived with Python 3.8
Assignee: nobody → rstewart

The keys of contexts are same, its root that differs. It starts with c:/ on Py3.7 but C:/ on Py3.8. (And posixpath.normpath does nothing with it.)

The key change is that os.path.realpath(os.path.abspath('.')) in 3.8 returns C:/... while 3.7 returned c:/....


Assignee: rstewart → mhentges

Err, mis-click on the assignee field there :)
Thanks for pushing that upstream bug :saschanaz!

os.path.realpath in Python 3.8 now always uppercases Windows drive letter, while it was just an alias of os.path.abspath in Windows. This patch uses .realpath() consistently to get topobjdir to fix the incompatibility from the behavior change.

Pushed by
Use os.path.realpath consistently r=rstewart
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Assignee: mhentges → krosylight
Has Regression Range: --- → yes
Keywords: regression
You need to log in before you can comment on or make changes to this bug.