Subject: Re: misc/23729: Syntax error: "(" unexpected
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: David Holland <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 10/08/2006 01:10:03
The following reply was made to PR misc/23729; it has been noted by GNATS.
From: dholland@eecs.harvard.edu (David Holland)
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: misc/23729: Syntax error: "(" unexpected
Date: Sat, 7 Oct 2006 21:07:25 -0400 (EDT)
As of now, the only widely used shells that try to run files that
won't exec() are sh and ksh. All the others fail, which you can verify
by taking your favorite hello.c, compiling, and then editing the
binary to replace "ld_elf.so" with, say, "ld_alf.so". This produces
these results:
% csh -c ./hullo
./hullo: Exec format error. Wrong Architecture.
% bash -c ./hullo
bash: ./hullo: cannot execute binary file
% tcsh -c ./hullo
./hullo: Exec format error. Binary file not executable.
% zsh -c ./hullo
zsh: exec format error: ./hullo
and
% sh -c ./hullo
./hullo: 1: Syntax error: "(" unexpected
% ksh -c ./hullo
./hullo: 1: Syntax error: "(" unexpected
The behavior exhibited by sh and ksh is historic, but hasn't been
useful since #! was invented, which was a long time ago.
Probably the best thing to do is to remove it.
--
- David A. Holland / dholland@eecs.harvard.edu