Xref: utzoo comp.bugs.4bsd:913 comp.unix.questions:8913 Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!unido!sbsvax!greim From: greim@sbsvax.UUCP (Michael Greim) Newsgroups: comp.bugs.4bsd,comp.unix.questions Subject: Re: Another bug with csh - `cat /tmp/a` Summary: empty strings in argv[0] Keywords: Ad-hoc parsing csh bug Message-ID: <604@sbsvax.UUCP> Date: 20 Aug 88 15:56:33 GMT References: <5144@vdsvax.steinmetz.ge.com> Organization: Universitaet des Saarlandes, Saarbruecken, West Germany Lines: 46 In article <5144@vdsvax.steinmetz.ge.com>, barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) writes: > I think I have found another bug with csh (surprise! :-) > Systems: SunOS 4.0, Ultrix 2.3. any many many more. > [stuff deleted] > But > `/tmp/a` > gives: > a: permission denied > : permission denied > Why two errors? The text within "`" is tried as a command, this is responsible for the first error. The result, a Null string, is returned. Then the csh tries to execute this result, a Null string. As this string does not start with a "/" csh searches for a file with this name in the directories specified in your path. It does so by trying to open the file in the directories of your path. The first try matches (!!). But as this file is most probably "." it cannot execute it, and this is responsible for the second error message. The string which is output, saying what file caused the error may vary with different implementations of csh or dir library routines. With my machines here, it is the empty (Null) string. Yes it is a bug but not only in csh. Csh should realize that the command's first word is empty. Try "cat ''" and you will get the contents of "." for the same reason : the first argument to cat is the Null string. The bug is really with open(2) and/or exec(2). I had it fixed for some time so that csh did not pass Null strings as parameters, but had to remove it for some reason, which does not come to my mind just now. Maybe test(1) did not perform correctly ? > > Now when I try: > `junkname` > where junkname does not exist, I get: > junkname: Command not found > /usr/ucb/: Permission denied Should be an effect of the same mechanism. -mg -- UUCP: ...!uunet!unido!sbsvax!greim | Michael T. Greim or greim@sbsvax.UUCP | Universitaet des Saarlandes CSNET: greim%sbsvax.uucp@Germany.CSnet| FB 10 - Informatik (Dept. of CS) ARPA: greim%sbsvax.uucp@uunet.UU.NET | Bau 36, Im Stadtwald 15 voice: +49 681 302 2434 | D-6600 Saarbruecken 11, West Germany # include