Skip to content

os/exec: LookPath uses a hard coded "/", assuming this is broken on Windows #60680

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
martinrode opened this issue Jun 8, 2023 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@martinrode
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.20.4 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

My assumption here is that os.LookPath will not work the same on Windows as it does on Linux / Mac. It will try to check the PATH environment even if the prog passed is utils\myprog.exe.

What did you do?

Read through the source code of LookPath.

What did you expect to see?

Something like filepath.Separator used instead of /.

What did you see instead?

A /

@qmuntal qmuntal added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jun 8, 2023
@qmuntal
Copy link
Member

qmuntal commented Jun 8, 2023

Thanks for reporting this @martinrode.

Could you link to the offending code using just /? I can't find it myself on the windows implementation at

func LookPath(file string) (string, error) {

Take into account that the unix implementation is not the same as the windows one. Could it be that you are looking at the former (located here) instead of the later?

@qmuntal qmuntal added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 8, 2023
@dmitshur dmitshur added this to the Backlog milestone Jun 9, 2023
@martinrode
Copy link
Author

Right, I am sorry for the confusion. The OS suffix is something I keep forgetting about ;-)

@dmitshur dmitshur closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2023
@golang golang locked and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants