Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site sdcrdcf.UUCP Path: utzoo!watmath!clyde!floyd!harpo!seismo!hao!hplabs!sdcrdcf!jonab From: jonab@sdcrdcf.UUCP (Jonathan Biggar) Newsgroups: net.unix,net.lang.c Subject: Re: 'exit(1);' considered useless (slight flame) Message-ID: <831@sdcrdcf.UUCP> Date: Thu, 9-Feb-84 12:42:24 EST Article-I.D.: sdcrdcf.831 Posted: Thu Feb 9 12:42:24 1984 Date-Received: Sat, 11-Feb-84 09:46:32 EST References: <934@cbosgd.UUCP> <957@cwruecmp.UUCP> Reply-To: jonab@sdcrdcf.UUCP (Jonathan Biggar) Organization: System Development Corporation, Santa Monica Lines: 35 In article <957@cwruecmp.UUCP> decot@cwruecmp.UUCP (Dave Decot) writes: >Perror() is not good because it discourages specific messages. The shells >should say: > > % file > file: data; not executable >or > file: program not executable by you > >instead of > > % file > file: permission denied > There are a couple reasons for this behavior: 1) All the shell does is to do an exec(2) (or variant thereof) on the file. It lets the kernel decide whether the user is allowed to execute that file. The kernal only returns the error EACCES which the shell cannot distinguish between the conditions of having the execute bit turned off on the file or one of the directories it searched to get to that file. For security reasons, it is best for the kernel not to give any more explicit information to the user. 2) In light of the first reason, one may ask why shouldn't the shell do what checking it is theoretically able to do? It shouldn't because that would require adding massive amounts of code to the shell to detect each possible error condition and report them. Also, the shell may not be able to determine exactly what the problem is because it does not have the appropriate permissions. (How is the shell supposed to tell the difference between a program that a user does not have permission to execute and data that a user does not have permission to execute?)