3 Commits

Author SHA1 Message Date
Ian Lance Taylor
6877dccfc2 execabs: don't override Go 1.19 error with our error
Go 1.19 incorporates the functionality of execabs directly.
If it has already reported an error, don't report our own error.

In particular Go 1.19 moved the error from lookPathErr to Err.
The code was already checking to not override lookPathErr.
With this change we also do not override Err.

Tested with Go 1.17 through Go 1.20.

Fixes golang/go#58606

Change-Id: I110127a3925f3800cc058d93e704604a59aa38f7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/469735
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-02-21 18:19:21 +00:00
Russ Cox
b6088ccd6c execabs: make safe for Go 1.19
To preserve the same errors that LookPath used to return,
LookPath needs to know to ignore the new Go 1.19 exec.ErrDot errors.

For golang/go#43724.

Change-Id: I8938813a1a4e14bf697f05879e3ab212611644da
Reviewed-on: https://go-review.googlesource.com/c/sys/+/403256
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-02 12:42:56 +00:00
Roland Shoemaker
b64e53b001 execabs: create execabs package
This package provides an alternative to os/exec that guarantees
never to satisfy a PATH lookup using an executable in the current
directory.

Change-Id: Id978f8039fe21687059c788836c79ae8e0930e92
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949732
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-on: https://go-review.googlesource.com/c/sys/+/284753
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-01-19 21:28:57 +00:00