Skip to content

[18.09 backport] Fix: plugin-tests discarding current environment - #1741

Merged
silvin-lubecki merged 1 commit into
docker:18.09from
thaJeztah:18.09_backport_fix_plugin_test
Mar 18, 2019
Merged

[18.09 backport] Fix: plugin-tests discarding current environment#1741
silvin-lubecki merged 1 commit into
docker:18.09from
thaJeztah:18.09_backport_fix_plugin_test

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

backport of #1713 for 18.09

By default, exec uses the environment of the current process, however,
if exec.Env is not nil, the environment is discarded:

https://github.com/golang/go/blob/e73f4894949c4ced611881329ff8f37805152585/src/os/exec/exec.go#L57-L60

If Env is nil, the new process uses the current process's environment.

When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.

Signed-off-by: Sebastiaan van Stijn github@gone.nl
(cherry picked from commit 6c4fbb7)
Signed-off-by: Sebastiaan van Stijn github@gone.nl

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

By default, exec uses the environment of the current process, however,
if `exec.Env` is not `nil`, the environment is discarded:
https://github.com/golang/go/blob/e73f4894949c4ced611881329ff8f37805152585/src/os/exec/exec.go#L57-L60
> If Env is nil, the new process uses the current process's environment.
When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6c4fbb7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah

Copy link
Copy Markdown
MemberAuthor

ping @vdemeester@silvin-lubecki

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #1741 into 18.09 will not change coverage.
The diff coverage is n/a.

@@ Coverage Diff @@## 18.09 #1741 +/- ##
=======================================
Coverage 54.09% 54.09% =======================================
Files 290 290 Lines 19406 19406 =======================================
Hits 10498 10498 Misses 8236 8236 Partials 672 672

@vdemeestervdemeester left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

@silvin-lubeckisilvin-lubecki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@silvin-lubecki
silvin-lubecki merged commit e63ac0e into docker:18.09Mar 18, 2019
@thaJeztah
thaJeztah deleted the 18.09_backport_fix_plugin_test branch March 18, 2019 13:53
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@thaJeztah@codecov-io@vdemeester@silvin-lubecki@GordonTheTurtle