]> Cypherpunks repositories - gostls13.git/commit
os/exec: return error when PATH lookup would use current directory
authorRuss Cox <rsc@golang.org>
Thu, 27 Jan 2022 17:59:37 +0000 (12:59 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 29 Apr 2022 20:16:31 +0000 (20:16 +0000)
commit3ce203db80cd1f320f0c597123b918c3b3bb0449
treeb04d8b6179ea82e08f5e39837fb77739f7dc3b35
parent8c5917cd76905b1ab16d41eadc8786e190eeecce
os/exec: return error when PATH lookup would use current directory

Following discussion on #43724, change os/exec to take the
approach of golang.org/x/sys/execabs, refusing to respect
path entries mentioning relative paths by default.

Code that insists on being able to find executables in relative
directories in the path will need to add a couple lines to override the error.

See the updated package docs in exec.go for more details.

Fixes #43724.
Fixes #43947.

Change-Id: I73c1214f322b60b4167a23e956e933d50470fe13
Reviewed-on: https://go-review.googlesource.com/c/go/+/381374
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
13 files changed:
api/next/43724.txt [new file with mode: 0644]
src/cmd/dist/build.go
src/cmd/dist/test.go
src/cmd/dist/util.go
src/cmd/go/testdata/script/cgo_path.txt
src/internal/execabs/execabs.go
src/internal/execabs/execabs_test.go [deleted file]
src/os/exec/dot_test.go [new file with mode: 0644]
src/os/exec/exec.go
src/os/exec/lp_plan9.go
src/os/exec/lp_unix.go
src/os/exec/lp_windows.go
src/os/exec/lp_windows_test.go