-
Notifications
You must be signed in to change notification settings - Fork 223
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
Failed to spawn a process -- buck2 tries to execute directory #670
Comments
Maybe your PATH on the remote executor contains "."? That might also explain it. It probably shouldn't. |
All these actions run locally ( I checked what $ PATH=.:$PATH strace -s 200 -e %file env -- nix --version
...
execve("./nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 EACCES (Permission denied)
execve("/nix/store/lf0wpjrj8yx4gsmw2s3xfl58ixmqk8qa-bash-5.2-p15/bin/nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 ENOENT (No such file or directory)
execve("./nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 EACCES (Permission denied)
execve("/nix/store/vwkvhj69z4qqgmpa2lwm97kabf12p26r-coreutils-9.3/bin/nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 ENOENT (No such file or directory)
execve("./nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 EACCES (Permission denied)
execve("/nix/store/g5p3ky90xa05ggg5szyb0pbbl2vp7n03-gnused-4.9/bin/nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 ENOENT (No such file or directory)
execve("./nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 EACCES (Permission denied)
execve("/nix/store/whwwhd6ns271bj0ff86ap37i9r9kzi9c-git-2.42.0/bin/nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 ENOENT (No such file or directory)
execve("./nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = -1 EACCES (Permission denied)
execve("/nix/store/11glc2yk4jmycvk42q6kikpdcpbnbf6w-nix-2.17.1/bin/nix", ["nix", "--version"], 0x7ffcb10b62e0 /* 167 vars */) = 0 whereas Bash also iterates the directories in PATH, but stats the file and checks if it is executable before running it: $ PATH=.:$PATH strace -fs 200 -e %file bash -c 'nix --version'
...
newfstatat(AT_FDCWD, "./nix", {st_mode=S_IFDIR|0755, st_size=106, ...}, 0) = 0
newfstatat(AT_FDCWD, "/nix/store/lf0wpjrj8yx4gsmw2s3xfl58ixmqk8qa-bash-5.2-p15/bin/nix", 0x7ffd26750d00, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "./nix", {st_mode=S_IFDIR|0755, st_size=106, ...}, 0) = 0
newfstatat(AT_FDCWD, "/nix/store/vwkvhj69z4qqgmpa2lwm97kabf12p26r-coreutils-9.3/bin/nix", 0x7ffd26750d00, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "./nix", {st_mode=S_IFDIR|0755, st_size=106, ...}, 0) = 0
newfstatat(AT_FDCWD, "/nix/store/g5p3ky90xa05ggg5szyb0pbbl2vp7n03-gnused-4.9/bin/nix", 0x7ffd26750d00, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "./nix", {st_mode=S_IFDIR|0755, st_size=106, ...}, 0) = 0
newfstatat(AT_FDCWD, "/nix/store/whwwhd6ns271bj0ff86ap37i9r9kzi9c-git-2.42.0/bin/nix", 0x7ffd26750d00, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "./nix", {st_mode=S_IFDIR|0755, st_size=106, ...}, 0) = 0
newfstatat(AT_FDCWD, "/nix/store/11glc2yk4jmycvk42q6kikpdcpbnbf6w-nix-2.17.1/bin/nix", {st_mode=S_IFREG|0555, st_size=2941200, ...}, 0) = 0
newfstatat(AT_FDCWD, "/nix/store/11glc2yk4jmycvk42q6kikpdcpbnbf6w-nix-2.17.1/bin/nix", {st_mode=S_IFREG|0555, st_size=2941200, ...}, 0) = 0
access("/nix/store/11glc2yk4jmycvk42q6kikpdcpbnbf6w-nix-2.17.1/bin/nix", X_OK) = 0
newfstatat(AT_FDCWD, "/nix/store/11glc2yk4jmycvk42q6kikpdcpbnbf6w-nix-2.17.1/bin/nix", {st_mode=S_IFREG|0555, st_size=2941200, ...}, 0) = 0
access("/nix/store/11glc2yk4jmycvk42q6kikpdcpbnbf6w-nix-2.17.1/bin/nix", R_OK) = 0
execve("/nix/store/11glc2yk4jmycvk42q6kikpdcpbnbf6w-nix-2.17.1/bin/nix", ["nix", "--version"], 0x68bbd0 /* 168 vars */) = 0 |
In our project I declared an action:
When running that action I got a mysterious error:
When trying to reproduce it locally, using the command from the log, it works:
Running buck2 under strace, revealed:
So, there is indeed a directory called
nix
in the project root directory which it is trying to execute.I think this is because the code introduced in 37f3d25 does only check if the file exists, not that it is an executable non-directory:
buck2/app/buck2_forkserver/src/run.rs
Lines 348 to 360 in 85f33c6
Also, it would have been nice to have a better error message that mentions the real cause of the error and the file it tried to execute.
My current workaround is to wrap command with
env --
:That should work as long as nobody creates an
env
directory I guess... 😄The text was updated successfully, but these errors were encountered: