Menu

#24 Lack of shebang line in script files gives "Exec format err"

other
closed-invalid
nobody
None
5
2018-03-17
2005-06-10
Mike Parker
No

Attempting to strace (v4.5.12) a C-Shell script file
missing its shebang (#!/bin/csh) header line causes
strace to give an "Exec format error". The same C-Shell
script file with a shebang line works fine.

This behaviour differs from that of the shell itself, which
will happily assume, in the absence of a shebang line
saying something different, that the contents of a file is
executable C-Shell script.

End result is that it is possible to run a non-shebang'ed
script from the command line that strace won't touch.
When the user isn't aware that they are running a script
(rather than a binary), much head scratching results
when strace won't run.

Discussion

  • Eugene Syromyatnikov

    • status: open --> closed-invalid
     
  • Eugene Syromyatnikov

    This is expected behaviour. It is now mentioned in v4.21-64-g07a6399.