Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/exec: environForSysProcAttr is never called as sysattr.Env is never nil [1.14 backport] #37471

Closed
toothrot opened this issue Feb 26, 2020 · 2 comments

Comments

@toothrot
Copy link
Contributor

@toothrot toothrot commented Feb 26, 2020

@ianlancetaylor requested issue #35314 to be considered for backport to the next 1.14 minor release.

I have no idea.

@gopherbot Please open backport issues

This may be security related on Windows systems.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Mar 29, 2020

Change https://golang.org/cl/226281 mentions this issue: [release-branch.go1.14] os/exec: use environment variables for user token when present

gopherbot pushed a commit that referenced this issue Mar 29, 2020
…oken when present

Builds upon the changes from #32000 which supported sourcing environment
variables for a new process from the environment of a Windows user token
when supplied.

But due to the logic of os/exec, the Env field of a process was
always non-nil when it reached that change.

This change moves the logic up to os/exec, specifically when
os.ProcAttr is being built for the os.StartProcess call, this
ensures that if a user token has been supplied and no Env slice has
been provided on the command it will be sourced from the user's
environment.

If no token is provided, or the program is compiled for any other
platform than Windows, the default environment will be sourced from
syscall.Environ().

For #35314
Fixes #37471

Change-Id: I4c1722e90b91945eb6980d5c5928183269b50487
GitHub-Last-Rev: 32216b7
GitHub-Pull-Request: #37402
Reviewed-on: https://go-review.googlesource.com/c/go/+/220587
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit e0c3ded)
Reviewed-on: https://go-review.googlesource.com/c/go/+/226281
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Mar 29, 2020

Closed by merging e6f15fa to release-branch.go1.14.

@gopherbot gopherbot closed this Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.