What file system are you using? I believe ext2 would always display
the permissions that are stored on the disk. This can be seen
> 3 > How exactly doees unlink".") work? What I feel is that the dir is
> unlinked but the inode is still active(refcnt>10 and process is able to
> acces the dir. as before until it exists. But what happemns if he now
> executes the pwd ccommand?
The VFS executes the per-fs unlink operation, but keeps the dcache
entries (at least in Linux 2.1). The inode won't be released until
the VFS calls the delete_inode operation, which is not called until
the last process releases the dentry.
What pwd would do depends on the implementation of pwd :-) Some shells
cache the path, and don't do any system calls. When they do so (e.g.
/bin/pwd), they call getcwd(3). In the current C library, this will try
to travers .., ../.., ../../.. etc, and try to find the cwd step by
step. If the current directory is unlinked, this will fail.
Future implementations might consider /proc/self/cwd instead.
> 4 > How does the mkdir command work exactly?
mkdir(1) invokes mkdir(2). This, in turn, invokes a file-system
dependent operation. On ext2, you can see the code in