Closed
Bug 766928
Opened 13 years ago
Closed 8 years ago
[pymake] Give a better error message when trying to use native commands inside a shell construct
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: ted, Unassigned)
Details
Currently if you do something like:
FOO = %module cmd
foo:
cd somewhere && $(FOO)
And run this in pymake your build will break with an unhelpful error message. We should at least make this error with a useful message somehow.
Comment 1•13 years ago
|
||
I think this will be difficult or impossible to do right.
To detect python native commands is effectively to detect where the first where the first character of a variable is '%'. Even this is challenging. If you are using recursively expanded variables (= not :=) for your rule bodies, this is pretty easy. We can modify the string expansion algorithm to bail if it sees a specific leading character. Even if you are using simply expanded variables, you can parse shell args from the string and find ones that begin with '%'. However, what if there are legitimate arguments beginning with '%'? e.g. |echo %|. Now you've just broken things.
You could also attempt to parse the to-be-executed command and find only commands, not arguments. But, this would require parsing shell scripts! And, since you can use .SHELL to override the shell rule bodies are executed in, this is a non-trivial problem.
I just don't think a technical solution is possible without potentially breaking *something*. Instead, I think we just need to be vigilant about where we use native commands. We can use static analysis (using the pymake API) to determine which variables get tainted by pymake native command variables. We could use this to reject Makefile generation, for example. Unfortunately, we can't use this same taint analysis generically as part of the pymake core API because we have no way of knowing which variables are commands and which are simple strings! Perhaps if we defined our build system in a schema that had richer type annotations...
Comment 2•13 years ago
|
||
The least we can do is to check after the fact (after a command has failed) to see if it had % characters and suggest to the user that pymake native commands are being used incorrectly.
Comment 3•8 years ago
|
||
Mass close of pymake-related bugs.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Updated•7 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•