Closed Bug 1628726 Opened 3 months ago Closed 3 months ago

Windows KeyError build failures in _emit_libs_derived with Python 3.8

Categories

(Firefox Build System :: General, defect)

Unspecified
Windows
defect
Not set
normal

Tracking

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

VERIFIED FIXED
mozilla77
Tracking Status
firefox-esr68 --- unaffected
firefox74 --- unaffected
firefox75 --- unaffected
firefox76 --- unaffected
firefox77 --- verified

People

(Reporter: RyanVM, Assigned: saschanaz)

References

(Regression)

Details

Attachments

(2 files)

Local bisection is pointing at bug 1627163 as the culprit.

Traceback (most recent call last):
  File "c:/Users/Ryan/repos/mozilla/configure.py", line 181, in <module>
    sys.exit(main(sys.argv))
  File "c:/Users/Ryan/repos/mozilla/configure.py", line 57, in main
    return config_status(config)
  File "c:/Users/Ryan/repos/mozilla/configure.py", line 176, in config_status
    return config_status(args=[], **normalize(sanitized_config))
  File "c:\Users\Ryan\repos\mozilla\python\mozbuild\mozbuild\config_status.py", line 145, in config_status
    definitions = list(definitions)
  File "c:\Users\Ryan\repos\mozilla\python\mozbuild\mozbuild\frontend\emitter.py", line 193, in emit
    objs = list(self._emit_libs_derived(contexts))
  File "c:\Users\Ryan\repos\mozilla\python\mozbuild\mozbuild\frontend\emitter.py", 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:/....

Filed https://bugs.python.org/issue40368.

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 krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/58be14829411
Use os.path.realpath consistently r=rstewart
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Status: RESOLVED → VERIFIED
Assignee: mhentges → krosylight
You need to log in before you can comment on or make changes to this bug.