Open Bug 978582 Opened 6 years ago Updated 2 years ago

Make moz.build reader error on tabs

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(Not tracked)

People

(Reporter: nalexander, Unassigned, Mentored)

Details

(Whiteboard: [lang=python][good second bug])

Per https://groups.google.com/d/msg/mozilla.dev.platform/WltNTXrqgFA/QhYDwBt3rqMJ, it would be nice to make tabs-in-moz.build files an error.  We should not, of course, make tabs in strings an error.
Whiteboard: [mentor=nalexander][lang=python][good second bug]
I found the following moz.build files that contained tabs (taken from mozilla-central changeset 1507f021ac93):
browser/components/customizableui/moz.build
dom/downloads/moz.build
modules/libjar/moz.build
security/manager/ssl/tests/gtest/moz.build
security/manager/ssl/tests/moz.build
toolkit/library/moz.build
tools/profiler/moz.build
None of the tabs were in strings, just in leading whitespace. (You could always use \t inside a string anyway.)
Can i pick this bug?
(In reply to adu from comment #2)
> Can i pick this bug?

Sure!  My guess is you should look at the code at

http://mxr.mozilla.org/mozilla-central/source/python/mozbuild/mozbuild/frontend/sandbox.py?force=1#349

and the tests at

http://mxr.mozilla.org/mozilla-central/source/python/mozbuild/mozbuild/test/frontend/test_sandbox.py?force=1

It's possible that Python will help us out here by rejecting tabs itself.  That would be be best, since we don't parse anything ourselves.  Start by looking into the options to compile(), invoked at

http://mxr.mozilla.org/mozilla-central/source/python/mozbuild/mozbuild/frontend/sandbox.py?force=1#373

Please update this ticket with what you find out, and thanks for helping out!
There are performance concerns at play here. We definitely want to avoid redundant I/O to scan the source of moz.build files and we'd like to minimize CPU when scanning moz.build files. Solutions that add over say 1s to moz.build scanning on a modern CPU will likely be scoured for perf drawbacks and asked to be corrected.

For the record, my Haswell MacBook Pro currently clocks in at:

Finished reading 2534 moz.build files in 1.75s

(From the output of `mach build-backend`)

And I /think/ a large amount of that time is spent in GYP processing (as opposed to core moz.build reading).
Mentor: nalexander
Whiteboard: [mentor=nalexander][lang=python][good second bug] → [lang=python][good second bug]
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.