This is busybox 1.10.2 (please re-check with a more recent version). Steps to reproduce: ~ $ touch exec ~ $ chmod +x exec ~ $ ./exec ~ $ echo $? Expected result: 127 Actual result: 0 This is a pain, I spent 30mins of debugging until I realized that scp has created and empty file only (which shouldn't be executable).
Exiting with EXIT_SUCCESS is ok and the expected, correct result. Which shell does exit with 127?
behavior is correct if a file is not handled by any file exec formats in the kernel, and the file does not have a shebang, then it falls back to running the file with /bin/sh since the file is empty, there is no way for the exit status to become non-zero