]> Cypherpunks repositories - gostls13.git/commit
os/exec: return error when PATH lookup would use current directory
authorRuss Cox <rsc@golang.org>
Sat, 30 Apr 2022 00:05:26 +0000 (20:05 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 2 May 2022 14:54:05 +0000 (14:54 +0000)
commit349cc83389f71c459b7820b0deecdf81221ba46c
treed21420aa8571fb505ab4bb040d289a6603ed0c88
parent32acceb359717e434ceb48681426b377b722d11e
os/exec: return error when PATH lookup would use current directory

CL 381374 was reverted because x/sys/execabs broke.

This CL reapplies CL 381374, but adding a lookPathErr error
field back, for execabs to manipulate with reflect.
That field will just be a bit of scar tissue in this package forever,
to keep old code working with new toolchains.

CL 403256 fixes x/sys/execabs's test to be ready for the change.
Older versions of x/sys/execabs will keep working
(that is, will keep rejecting what they should reject),
but they will return a slightly different error from LookPath
without that CL, and the test fails because of the different
error text.

For #43724.

This reverts commit f2b674756b3b684118e4245627d4ed8c07e518e7.

Change-Id: Iee55f8cd9939e1bd31e5cbdada50681cdc505117
Reviewed-on: https://go-review.googlesource.com/c/go/+/403274
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@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