Closed Bug 782847 Opened 12 years ago Closed 12 years ago

Pymake native commands don't pass the correct environment to subprocesses

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla17

People

(Reporter: rain1, Assigned: rain1)

References

Details

Attachments

(1 file)

http://hg.mozilla.org/users/bsmedberg_mozilla.com/pymake/file/7d221562bc4a/pymake/process.py#l209 sets os.environ to a new dictionary. However, os.environ is actually a magic dictionary which calls os.putenv and affects the environment of subprocesses, while this one doesn't.

Oh, Python...
Blocks: 593585
Assignee: nobody → sagarwal
Status: NEW → ASSIGNED
Attachment #651965 - Flags: review?(ted.mielczarek)
Comment on attachment 651965 [details] [diff] [review]
use clear() and update() instead

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

This looks good to me.

Please note in the commit message that this is backwards incompatible but it brings native command behavior inline with what it should have been.

::: tests/pycmd.py
@@ +9,5 @@
>      f.write(os.environ[args[1]])
>  
> +def writesubprocessenvtofile(args):
> +  with open(args[0], 'w') as f:
> +    p = subprocess.Popen([sys.executable, "-c", 

whitespace.

@@ +12,5 @@
> +  with open(args[0], 'w') as f:
> +    p = subprocess.Popen([sys.executable, "-c", 
> +                          "import os; print os.environ['%s']" % args[1]],
> +                          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> +    stdout, stderr = p.communicate()

Shouldn't there be a p.wait() here?
Attachment #651965 - Flags: review?(ted.mielczarek) → review+
(In reply to Gregory Szorc [:gps] from comment #2)
> @@ +12,5 @@
> > +  with open(args[0], 'w') as f:
> > +    p = subprocess.Popen([sys.executable, "-c", 
> > +                          "import os; print os.environ['%s']" % args[1]],
> > +                          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> > +    stdout, stderr = p.communicate()
> 
> Shouldn't there be a p.wait() here?

communicate implies wait: http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate
Pushed to the Pymake repository.
http://hg.mozilla.org/users/bsmedberg_mozilla.com/pymake/rev/8360595070d6

I'll push to mozilla-inbound once it reopens.
https://hg.mozilla.org/mozilla-central/rev/dfe6a63f3ae9
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
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.

Attachment

General

Created:
Updated:
Size: