-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to kuldeep vyas on 11/21/2005 4:42 AM: > Hi, > > I'm using Redhat 9 (kernel 2.4.20-8 on i686) > I logged in as k(username), then I started terminal, & > then I gave following commands:- > > k>pwd > /home/k > > k>mkdir my_dir > // i created a directory: my_dir > > k>cd my_dir > // let's go in my_dir > > > // now let's try to remove my_dir > k>rmdir /home/k/my_dir > // no error; ... > pwd says I'm in my_dir, but my_dir doesn't exist. > I think: user should not be allowed to remove a directory, > until & unless he is placed in a directory which is > hierarchically above the one he has chosen to remove.
POSIX allows this behavior, but does not require it. Basically, on systems where it is legal to remove a directory that is in use, such as on Linux, the directory continues to exist until all references to it (such as processes that have it as the current working directory) have closed their file descriptors, even though the directory is no longer accessible from the file system. On other platforms, such as cygwin, where removing an in-use directory is forbidden by the OS, rmdir faithfully returns the error 'Device or resource busy'. It is a feature of Linux, and not a bug in coreutils, that rmdir on Linux can remove an in-use directory; and coreutils is just happy to provide the exact capabilities of the underlying system in this case. > > If my approach is not right, I'd like to know the > philosophy behind this. You are welcome to try and patch the Linux kernel to have rmdir fail with EBUSY if the directory is in use, but you will probably find that this increases the complexity of the kernel and would be a tough sell to the kernel crowd. - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDgc/W84KuGfSFAYARAiIbAKCX/2SzbsWHbB/3DDBnQZGiVio/0wCfSQ4q 9Pw6xoNu9gBiM3o1shwxJRU= =GbPm -----END PGP SIGNATURE----- _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils