Re: Correct semantics in rm -rf ?

2009-08-31 Thread Jim Meyering
shailesh jain wrote: ... POSIX allows readdir to work that way. Sorry I do not follow your comment. What way POSIX allows readdir to work ? As was demonstrated by that strace output: returning an entry for a file that had been unlinked. I already suggested that making this change might help

Re: Correct semantics in rm -rf ?

2009-08-27 Thread shailesh jain
Here it is. Outcome is that Child gets deleted but parent does not get deleted. (Now you will say it's a filesystem issue ;) ) fstatat64(AT_FDCWD, parent, {st_mode=S_IFDIR|0755, st_size=72, ...}, AT_SYMLINK_NOFOLLOW) = 0 unlinkat(AT_FDCWD, parent, 0) = -1 EISDIR (Is a directory)

Re: Correct semantics in rm -rf ?

2009-08-27 Thread Jim Meyering
shailesh jain wrote: Here it is. Outcome is that Child gets deleted but parent does not get deleted. (Now you will say it's a filesystem issue ;) ) Let's start with the command you used here. It must not have been rm -rf, because the ENOENT is not being ignored: fstatat64(AT_FDCWD,

Re: Correct semantics in rm -rf ?

2009-08-27 Thread shailesh jain
On Thu, Aug 27, 2009 at 12:40 PM, Jim Meyering j...@meyering.net wrote: shailesh jain wrote: Here it is. Outcome is that Child gets deleted but parent does not get deleted. (Now you will say it's a filesystem issue ;) ) Let's start with the command you used here. It must not have

Re: Correct semantics in rm -rf ?

2009-08-26 Thread Jim Meyering
shailesh jain wrote: rm -rf does following (highly simplified) remove_cwd_entries() { // Check if dirp is empty ... readdir(); } remove_dir() { while(1) { remove_cwd_entries(); // Get the fd of directory fd = open(); // Unlink empty_dir unlinkat();

Re: Correct semantics in rm -rf ?

2009-08-26 Thread Jim Meyering
shailesh jain wrote: On Wed, Aug 26, 2009 at 2:36 AM, Jim Meyering j...@meyering.net wrote: ... If you can demonstrate an actual failure, or even that rm is merely performing unnecessary unlinkat calls, please provide details. Thanks for consideration. I will describe how 'rm -rf parent'

Re: Correct semantics in rm -rf ?

2009-08-26 Thread Jim Meyering
shailesh jain wrote: I have attached a log file. Note I have ran this on local file system where rm -rf works not on Network file system (I was running into some issues which I am trying to resolve ..). However, this run also gives us lot of information and demonstrates that even though rm

Re: Correct semantics in rm -rf ?

2009-08-26 Thread shailesh jain
I have attached a log file. Note I have ran this on local file system where rm -rf works not on Network file system (I was running into some issues which I am trying to resolve ..). However, this run also gives us lot of information and demonstrates that even though rm -rf works, it is does not

Re: Correct semantics in rm -rf ?

2009-08-26 Thread shailesh jain
On Wed, Aug 26, 2009 at 3:07 PM, Jim Meyering j...@meyering.net wrote: shailesh jain wrote: I have attached a log file. Note I have ran this on local file system where rm -rf works not on Network file system (I was running into some issues which I am trying to resolve ..). However, this

Correct semantics in rm -rf ?

2009-08-25 Thread shailesh jain
Hi All, rm -rf does following (highly simplified) remove_cwd_entries() { // Check if dirp is empty ... readdir(); } remove_dir() { while(1) { remove_cwd_entries(); // Get the fd of directory fd = open(); // Unlink empty_dir unlinkat(); dirp =