Closed Bug 782866 Opened 7 years ago Closed 7 years ago

Pymake: commands that don't use shells don't honour exported PATH on Win32

Categories

(Firefox Build System :: General, defect)

x86_64
Windows 7
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla17

People

(Reporter: rain1, Assigned: rain1)

References

Details

Attachments

(1 file, 2 obsolete files)

I think the right thing to do here will be to special-case PATH. Gah...
For a simple command, e.g. |cl|, shellreason will be None.
Right, that was one of the big Pymake wins (not spawning extraneous shells). How did our build ever work if this is broken? Things like "rm foo" would presumably not work.
Sorry, the title was a bit unclear: they do honour the parent's path normally. They just don't honour the PATH variable if it's exported from within the makefile, as we have in our Win32 mozconfigs.

I have a working patch -- struggling to write a test right now.
Summary: Pymake: commands that don't use shells don't honour PATH on Win32 → Pymake: commands that don't use shells don't honour exported PATH on Win32
Attached patch patch v1 (obsolete) — Splinter Review
I believe this should fix things up. I'm running a test build on my build slave to make sure it does.
Assignee: nobody → sagarwal
Status: NEW → ASSIGNED
Attachment #652083 - Flags: review?(ted.mielczarek)
Yes, the build works now.
(In reply to Ted Mielczarek [:ted] from comment #5)
> Right, that was one of the big Pymake wins (not spawning extraneous shells).
> How did our build ever work if this is broken? Things like "rm foo" would
> presumably not work.

I would throw out that I believe a proper build system deduces absolute paths during a "configure" phase and all paths in the build phase (even for things that are not binaries) are absolute paths.

I threw in *all* paths because we have a lot of code today that works on relative paths. For example, the include paths are relative. In the case of includes, those relative paths get written in the auto-generated makefile dependency files, which means that that .mk file can only be evaluated from a specific directory. This prevents non-recursive evaluation. Doh.
Attached patch patch with fixed executable bit (obsolete) — Splinter Review
With this fix the test works on Linux as well.
Attachment #652083 - Attachment is obsolete: true
Attachment #652083 - Flags: review?(ted.mielczarek)
Attachment #653937 - Flags: review?(gps)
Comment on attachment 653937 [details] [diff] [review]
patch with fixed executable bit

Review of attachment 653937 [details] [diff] [review]:
-----------------------------------------------------------------

The hack, it hurts.

This is effectively r+. I just want answers to my questions first.

::: pymake/process.py
@@ +172,3 @@
>          try:
> +            if self.env is not None and self.env.has_key('PATH'):
> +                os.environ['PATH'] = self.env['PATH']

I understand modifying os.environ is safe given the current execution model. But, it makes me uneasy.

To help me rest better, how do you feel about setting a module-level flag when running and asserting in run() that it isn't set? i.e. if we ever change the execution model of pymake, I want this to die loudly.

::: tests/subprocess-path.mk
@@ +1,4 @@
> +#T gmake skip
> +#T grep-for: "2f7cdd0b-7277-48c1-beaf-56cb0dbacb24"
> +
> +ifdef __WIN32__

Where does this come from?

@@ +22,5 @@
> +#
> +# Q. Why use an exe and not a batch file?
> +# A. The use cases here were all exe files without the extension. Batch file
> +#    lookup has broken semantics if the .bat extension isn't passed.
> +#  

Whitespace.
Attachment #653937 - Flags: review?(gps)
Good catch! This patch means that now all commands are run through child processes.

__WIN32__ is defined in runtests.py.
Attachment #653937 - Attachment is obsolete: true
Attachment #654042 - Flags: review?(gps)
So um, you mean you regressed bug 602506?
Hmm, I guess so. However I did do a full build on a build slave and it took about the same time, give or take a few seconds.

I don't see how this bug can be reconciled with bug 602506 :(
On a build slave, a -j4 build with same-process Popen took 32:59, while a -j4 build with different-process Popen took 33:14. I don't think it's a big concern any more.
Comment on attachment 654042 [details] [diff] [review]
remove threadpool, and make sure we're in a different process

Review of attachment 654042 [details] [diff] [review]:
-----------------------------------------------------------------

The removal of the multiprocessing.dummy foo scared me. But, apparently it doesn't make a difference and Ted's OK with it. So, I'm OK with it.
Attachment #654042 - Flags: review?(gps) → review+
http://hg.mozilla.org/users/bsmedberg_mozilla.com/pymake/rev/5d2775d6a2d5
http://hg.mozilla.org/mozilla-central/rev/21a815b9f4c7
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.