4 ms·
I was going to see what strace does with an empty /tmp/foo, and it fails: > write(2, "strace: exec: Exec format error\n", 32strace: exec: Exec format error So
by rrauenza 5y ago
I was going to see what strace does with an empty /tmp/foo, and it fails:
> write(2, "strace: exec: Exec format error\n", 32strace: exec: Exec format error
So the empty file is not exec()able. I think it can only be invoked from a shell.
subprocess.call("/tmp/foo", shell=xxxx) demonstrates it.
I wonder if that was the case for Unix v7 that had it zero length? (...mentioned in another thread.)
- dfox 5y agoFrom quick scan of v7 exec() implementation it seems that it has to be case as getxfile() would return ENOEXEC for files smaller than sizeof(u_exdata) (which is a.out header as C struct).