Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/run: Unbreak 'enter' if the shell had exited with 127
Currently, 'toolbox enter' can get into a loop if the user tried to run something inside the shell that didn't exist, and quit immediately afterwards: $ toolbox enter ⬢$ foo bash: foo: command not found ⬢$ logout Error: command /bin/bash not found in container fedora-toolbox-34 Using /bin/bash instead. ⬢$ This is because: * The shell forwards the exit code of the last command that was invoked as its own exit code. If the last command that was attempted was absent then this exit code is 127. * 'podman exec' uses 127 as the exit code when it can't invoke the command. If it's able to successfully invoke the command, it forwards the exit code of the command itself. Therefore, in the above example 'podman exec' itself returns with an exit code of 127 even though both the working directory and the command that were passed to it were present. Hence, it's necessary to explicitly check if the requested command was really absent before attempting the fallbacks. Fallout from 4536e2c containers#872
- Loading branch information