Subject: Re: more user-friendly error message for /bin/sh?
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-userlevel
Date: 01/16/2007 20:04:25
In article <45AD2E2A.7060908@NetBSD.org>,
Roland Illig <rillig@NetBSD.org> wrote:
>-=-=-=-=-=-
>
>Currently, I can do this:
>
>$ /bin/sh /bin/cat
>/bin/cat: 1: Syntax error: "(" unexpected
>
>What about the following error message, which says what's really the
>problem:?
>
>$ ./sh /bin/cat
>./sh: Cannot execute ELF binary /bin/cat
>
>(I just hope no one says they really have shell scripts starting with
>the ELF magic code, and that they need those bytes at the start of the
>script. ;))
>
What about other binary files that the kernel can run? a.out for example?
coff?
I would say just check if the first few bytes of the file are non ascii,
and say that you cannot execute binary /bin/cat...
christos