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.13 backport] #37433

gopherbot opened this issue Feb 25, 2020 · 2 comments


Copy link

@gopherbot gopherbot commented Feb 25, 2020

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

I have no idea.

@gopherbot Please open backport issues

This may be security related on Windows systems.

Copy link

@gopherbot gopherbot commented Mar 29, 2020

Change mentions this issue: [release-branch.go1.13] 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

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

For #35314
Fixes #37433

Change-Id: I4c1722e90b91945eb6980d5c5928183269b50487
GitHub-Last-Rev: 32216b7
GitHub-Pull-Request: #37402
Run-TryBot: Ian Lance Taylor <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Ian Lance Taylor <>
Copy link

@gopherbot gopherbot commented Mar 29, 2020

Closed by merging 6fcea1e to release-branch.go1.13.

@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
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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