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: modifications to Path ignored when *Cmd is created using Command with an absolute path on Windows [1.22 backport] #68331

Closed
gopherbot opened this issue Jul 7, 2024 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases OS-Windows
Milestone

Comments

@gopherbot
Copy link
Contributor

@dmitshur requested issue #68314 to be considered for backport to the next 1.22 minor release.

@gopherbot Please backport to Go 1.22. Only Go 1.22 needs the fix, as this isn't an issue in Go 1.2​1.

This is a regression that can cause wrong binaries to be executed on Windows, with no workaround other than changing user code.

@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/596976 mentions this issue: [release-branch.go1.22] os/exec: only use cachedLookExtensions if Cmd.Path is unmodified

@cagedmantis
Copy link
Contributor

Approved. This is a regression that can cause wrong binaries to be executed on Windows, with no workaround other than changing user code.

@cagedmantis cagedmantis added the CherryPickApproved Used during the release process for point releases label Jul 10, 2024
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jul 10, 2024
gopherbot pushed a commit that referenced this issue Jul 10, 2024
….Path is unmodified

Caching the invocation of lookExtensions on an absolute path in Command
and reusing the cached result in Start is only viable if Cmd.Path isn't
set to a different value after Command returns.

For #66586.
For #68314.
Fixes #68331.

Change-Id: I57007850aca2011b11344180c00faded737617b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/596875
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
(cherry picked from commit d0146bd)
Reviewed-on: https://go-review.googlesource.com/c/go/+/596976
@gopherbot
Copy link
Contributor Author

Closed by merging ea96074 to release-branch.go1.22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases OS-Windows
Projects
None yet
Development

No branches or pull requests

3 participants