Bug 123 - Executes empty files without issues
Summary: Executes empty files without issues
Status: RESOLVED INVALID
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-23 08:55 UTC by Sven Herzberg
Modified: 2009-03-19 05:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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