Subject: Re: more user-friendly error message for /bin/sh?
To: None <firstname.lastname@example.org>
From: Christos Zoulas <email@example.com>
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
>$ ./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
What about other binary files that the kernel can run? a.out for example?
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...