dave@utcsrgv.UUCP (Dave Sherman) (07/05/84)
Running 4.1, I tried to do
tail foo/bar
and got
foo/bar: Permission denied
which surprised me, since I was in my own directory. Turns out
that "foo" exists, but is a file, not a directory. The error
value really should be ENOENT ("No such file or directory") rather
than EACCES ("Permission denied").
This doesn't show up running tail(1) on v7, since v7 tail doesn't
call perror, but a test of perror revealed the same treatment.
Any reason why open("file/file") should return EACCES? The v7
manual page for intro(2) says EACCES means "An attempt was made
to access a file in a way forbidden *by the protection system*"
(emphasis mine).
Dave Sherman
Toronto
--
{allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave
or
David_Sherman%Wayne-MTS%UMich-MTS.Mailnet@MIT-Multics.ARPAopus@drutx.UUCP (ShanklandJA) (07/07/84)
> Any reason why open("file/file") should return EACCES [rather > than ENOENT if the first file exists, but is not a directory]? Yeah (or at least, sort of). If the first file didn't have execute permission set, it wouldn't be "searchable" as a directory. Granted, it would probably be clearer if the kernel checked whether 'file1' was a directory BEFORE checking the permission bits to see if it could be searched, rather than after; but I'll be willing to bet that's exactly what's happening. Jim Shankland ..!ihnp4!druxy!opus
scw@UCLA-LOCUS.ARPA (07/09/84)
From: Steve Woods <cepu!scw@UCLA-LOCUS.ARPA> >From: decvax!linus!utzoo!utcsrgv!dave@UCB-VAX.ARPA >Running 4.1, I tried to do > tail foo/bar >and got > foo/bar: Permission denied >which surprised me, since I was in my own directory. Turns out >that "foo" exists, but is a file, not a directory. The error >value really should be ENOENT ("No such file or directory") rather >than EACCES ("Permission denied"). >Any reason why open("file/file") should return EACCES? The v7 >>manual page for intro(2) says EACCES means "An attempt was made >to access a file in a way forbidden *by the protection system*" >(emphasis mine). Seems that it checks for the access bits first and only then trys to access a directory. The follwoing thes was run under v7. This program: char file1[]="test.x/foo"; char file2[]="test.f/foo"; main(argc,argv) int argc; char **argv; { if(open(file1,0) < 0)perror(file1); if(open(file2,0) < 0)perror(file2); } Run on this directory: -rwxrwxr-x 1 scw 1622 Jul 9 07:51 test -rw-rw-r-- 1 scw 190 Jul 9 07:51 test.c -rw-rw-r-- 1 scw 0 Jul 9 07:47 test.f -rwxrwxr-x 1 scw 8 Jul 9 07:46 test.x Produces the following output: test.x/foo: Not a directory test.f/foo: Permission denied ------ Stephen C. Woods (VA Wadsworth Med Ctr./UCLA Dept. of Neurology) uucp: { {ihnp4, uiucdcs}!bradley, hao, trwrb, sdcsvax!bmcg}!cepu!scw ARPA: cepu!scw@ucla-cs CORRECTED location: N 34 3' 9.1" W 118 27' 4.3"