Skip to content

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

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

Closed
toothrot opened this issue Feb 26, 2020 · 2 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@toothrot
Copy link
Contributor

@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.

@toothrot toothrot added the CherryPickCandidate Used during the release process for point releases label Feb 26, 2020
@toothrot toothrot added this to the Go1.14.1 milestone Feb 26, 2020
@cagedmantis cagedmantis modified the milestones: Go1.14.1, Go1.14.2 Mar 19, 2020
@andybons andybons added the CherryPickApproved Used during the release process for point releases label Mar 26, 2020
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Mar 26, 2020
@gopherbot
Copy link
Contributor

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
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Mar 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants