Change the executing of a 0-byte file to be an error...

Wartan Hachaturow wartan.hachaturow at gmail.com
Fri Jun 10 11:32:29 GMT 2005


On 6/10/05, Garance A Drosihn <drosih at rpi.edu> wrote:

> error?  I read through a few likely pages in SUSv3, and it looked
> like the behavior for executing an 0-byte file is not explicitly
> defined.  Of course, it might be that I was simply looking in the
> wrong part of the standard.

To quote SUSv3's Shell and Utilities:
"If the execve() function fails due to an error equivalent to the
[ENOEXEC] error  defined in the System Interfaces volume of IEEE Std
1003.1-2001, the shell shall execute a command equivalent to having a
shell invoked with the command name as its first operand, with any
remaining arguments passed to the new shell. If the executable file is
not a text file, the shell may bypass this command execution. In this
case, it shall write an error message, and shall return an exit status
of 126."

So it is merely an empty script execution. The kernel reports a failure, as it
should.

-- 
Regards, Wartan.


More information about the freebsd-standards mailing list