unix quirks (chmod 000 dir)

David Elliott dce at hammer.UUCP
Tue Apr 23 00:55:51 AEST 1985


In article <9938 at brl-tgr.ARPA> argv at ucb-vax.ARPA writes:
>
>    >>% mkdir foo
>    >>% chmod 000 foo
>    >>% cd foo
>    >>foo: no such file or directory
>You don't seem to understand: it shouldn't say: "no such file or directory",
>it should say: "Permission denied."  The example, was just that, an example.
>This "bug" appears all the time whenever the permission is denied, it comes
>up with the wrong error message! Try to cd into a path that you never had
>any problems with and it says that it doesn't even EXIST. Then you panic and
>call the system administrator and request a back up recovery and spend a
>lot of time and effort (sometimes even money) to get a directory replaced
>that never even went away. I just want the correct error message. Is this
>clear now?

The problem is the fact that the csh cd command is running through the
cdpath vector, attempting to do a chdir() each time. When the error message
is finally printed, it is done using the last value of errno (in this case,
ENOENT). Thus, you get "no such file or directory".

Possible fixes:

	1. Change the cd code to print an error message for each attempt
	   that does not result in errno being ENOENT.

	2. Change the cd code to save errno if it isn't ENOENT, and use
	   this saved value (default ENOENT) to print the message.


			David Elliott
			tektronix!tekecs!dce



More information about the Comp.unix.wizards mailing list