Skip to content

subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True) behaves incorrect in newer python:3.6.5 python:3.6.6 python:3.7.0 #331

@Aaron2Ti

Description

@Aaron2Ti

On 3.6.4 the env variables are passed correctly to subprocess

↪ docker run -it --rm python:3.6.4
Python 3.6.4 (default, Mar 14 2018, 17:49:05)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True)
need.env.flag.with.dot=true     # <----  this is correct behavior to us
PWD=/
0
>>>
↪ docker run -it --rm python:3.6.4-alpine
Python 3.6.4 (default, Jan 10 2018, 05:26:33)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True)
SHLVL=1
need.env.flag.with.dot=true
PWD=/
0
>>>
↪ docker run -it --rm python:3.6.6-alpine
Python 3.6.6 (default, Aug 22 2018, 20:48:31)
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True)
need.env.flag.with.dot=true
SHLVL=1
PWD=/
0
>>>
↪ docker run -it --rm python:3.7.0-alpine
Unable to find image 'python:3.7.0-alpine' locally
3.7.0-alpine: Pulling from library/python
Digest: sha256:2b0c0bfceea1bc00e87f03b8b1b8adda89dfe9e9cceb03fd1adfca3a511a5340
Status: Downloaded newer image for python:3.7.0-alpine
Python 3.7.0 (default, Aug 22 2018, 20:39:59)
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True)
need.env.flag.with.dot=true
SHLVL=1
PWD=/
0
>>>

however for newer python:3.6.5 and upon, the behavior was wrong

↪ docker run -it --rm python:3.6.5
Python 3.6.5 (default, Jun 27 2018, 08:15:56)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True)
PWD=/
0
>>>
↪ docker run -it --rm python:3.7.0
Python 3.7.0 (default, Aug  4 2018, 02:33:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True)
PWD=/
0
>>>
↪ docker run -it --rm python:3.6.5-alpine
Python 3.6.5 (default, Jun  6 2018, 23:08:29)
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call('env', env={'need.env.flag.with.dot': 'true'}, shell=True)
SHLVL=1
PWD=/
0
>>>

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions