Messages in this thread | | | From | (Linus Torvalds) | Subject | Re: happiness and joy w/ 2.1.47 (or problems w/ access()) | Date | 27 Jul 1997 19:58:17 GMT |
| |
In article <199707270708.AAA11715@zoogx.zoology.washington.edu>, a sun <asun@zoology.washington.edu> wrote: > >it looks like 2.1.47 still hasn't achieved dentry >perfection. access("file/.", F_OK) returns 0 despite the fact that >"file" is not a directory. even better, this only happens for root as >far as i can tell.
No, it happens for everybody, but the file has to be executable (except for root).
The reason is simply that the "." and ".." special cases were handled before we even tested that it was a directory.
So with 2.1.47, do this:
touch normal_file chmod +x normal_file ls normal_file/..
and you'll see a directory listing of the current directory: ".." of a file is the directory it is in ;)
You can also do
echo hello > normal_file cat normal_file/
and you'll get "hello". This behaviour (together with the "." and ".." handling) is actually all very orthogonal if you look at it the right way: think of the slash as just a separator in the name space, not as a "directory" thing, and "." and ".." as just ways to move in the name space rather than in a "directory hierarchy".
So I could just call this a very strange feature, but I guess I'd better not. Especially as it's very likely against various standards, POSIX being just one of them.
The "." and ".." are truly trivial to fix (they are fixed in my current sources, so that particular feature will be gone in 2.1.48).
The trailing slash handling is not hard, but it is made less trivial by the fact that the rules for trailing slashes are by no means obvious - some of the rules are totally arbitrary rules laid down by committees (POSIX). So instead of just organizing the sources to automatically get the trailing slashes right I will have to add silly rules for special cases.
>also, i've been trying to track down a problem w/ a program that's >dying on me. it's generating an exception for which i would like to >figure out the cause. is there a way to transmogrify the exception >address into something useful like the calling function?
Is this a kernel dump? Use "ksymoops" from linux/scripts/.
Linus
| |