The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in mozilla17

Status

()

Core
Build Config
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: sid0, Assigned: sid0)

Tracking

Trunk
mozilla17
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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...
(Assignee)

Updated

5 years ago
Blocks: 593585
(Assignee)

Comment 1

5 years ago
Created attachment 651965 [details] [diff] [review]
use clear() and update() instead
Assignee: nobody → sagarwal
Status: NEW → ASSIGNED
Attachment #651965 - Flags: review?(ted.mielczarek)

Comment 2

5 years ago
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+
(Assignee)

Comment 3

5 years ago
(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
(Assignee)

Comment 4

5 years ago
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.
(Assignee)

Comment 5

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/dfe6a63f3ae9
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/dfe6a63f3ae9
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.