Skip to content

os/exec: windows LookPath is broken #6224

@gopherbot

Description

@gopherbot

by atkaaz:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
on Windows btw.
1. set PATHEXT=.BAT
2. go run hello.go
3.

What is the expected output?
no errors and hello world program runs

What do you see instead?
go build command-line-arguments: exec:
"c:\\Go\\pkg\\tool\\windows_386\\8g.exe": file does not exist

Which compiler are you using (5g, 6g, 8g, gccgo)?
8g

Which operating system are you using?
Windows 7 64bit

Which version are you using?  (run 'go version')
go version go1.1.2 windows/386


Please provide any additional information below.
LookPath is called with "c:\Go\pkg\tool\windows_386\8g.exe" and the fact that
PATHEXT is being set in an evil way let's say, make LookPath ....

This apparently works on linux because absolute path is starting with / or other
variants. But on windows it can be drive letter...

quick jump to LookPath function(in master):
http://code.google.com/p/go/source/browse/src/pkg/os/exec/lp_windows.go?name=default#51

This issue was encountered by one person (not me), here:
https://groups.google.com/d/msg/golang-nuts/mDzGuofHvxk/i1n0STnVl0cJ


unsetting PATHEXT will cause it to work, or setting it to the default which is:
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions