-
Notifications
You must be signed in to change notification settings - Fork 18k
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
os/exec: LookPath() doesn't consider chroot #39341
Comments
Hello, I want to help to solve the problem. Is it suitable to check whether file path exists in the |
Perhaps |
I have found some bug in my code, so I close the original PR. The problem is more complex than I thought, because I also need to deal with |
Change https://golang.org/cl/236780 mentions this issue: |
One thing to be careful for when fixing this is that chrooting will also affect the targets of symlinks. For example, a root directory containing a symlink pointing to One workaround we're using in bb-remote-execution is that we prepend |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Where
/home/scottclarke/chroot
contains a chroot which has an executable file/bin/hello
, and there is no executablehello
in the PATH of the system prior to the chroot.What did you expect to see?
The
hello
executable being run, producing the outputhello world
.What did you see instead?
The following error:
2020/06/01 11:36:32 "exec: \"hello\": executable file not found in $PATH"
This happens because the
exec.Command()
function callsLookPath()
and sets thelookPathErr
if it fails, which is checked inStart()
and causes a failure. However this doesn't take into account the fact that the command will be run in a chroot.The text was updated successfully, but these errors were encountered: