Bug 123

Summary: Executes empty files without issues
Product: Busybox Reporter: Sven Herzberg <sven>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED INVALID    
Severity: enhancement CC: rep.dot.nop
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Sven Herzberg 2009-02-23 08:55:37 UTC
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).
Comment 1 Bernhard 2009-02-23 09:08:03 UTC
Exiting with EXIT_SUCCESS is ok and the expected, correct result.
Which shell does exit with 127?
Comment 2 Mike Frysinger 2009-03-19 05:39:19 UTC
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