Subject: Re: more user-friendly error message for /bin/sh?
To: None <firstname.lastname@example.org>
From: Roland Illig <rillig@NetBSD.org>
Date: 01/17/2007 04:22:25
Joerg Sonnenberger wrote:
> On Tue, Jan 16, 2007 at 08:16:19PM -0500, James K. Lowden wrote:
>>It's also not necessary IMO to check if fd is a regular file. If it
>>seeks, it seeks, else it returns -1, errno will be ESPIPE, and life goes
> /bin/sh - and other use cases?
$ cat ./sh | ./sh -
sh: Syntax error: "(" unexpected
Since stdin is a pipe here, it is not seekable. Not even to (0,SEEK_SET)
when the file pointer is already there. Therefore the old, confusing
error message is printed.
$ ./sh ./sh
./sh: Cannot execute ELF binary ./sh
That way it works.