bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct semantics in rm -rf ?


From: shailesh jain
Subject: Re: Correct semantics in rm -rf ?
Date: Thu, 27 Aug 2009 13:10:59 -0700

On Thu, Aug 27, 2009 at 12:40 PM, Jim Meyering <address@hidden> 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 been rm -rf, because the ENOENT is not being ignored:
>

huh ? I used rm -rf .... If ENOENT should have been ignored then there you
see another bug  ;).



>
> > 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)
> > openat(AT_FDCWD, "parent",
> > O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW)
> > = 3
> > fstat64(3, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
> > fstat64(3, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
> > fcntl64(3, F_GETFL)                     = 0x28800 (flags
> > O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW)
> > fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
> > fstat64(3, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
> > getdents64(3, /* 3 entries */, 1024)    = 80
> > openat(3, "Child", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW) =
> 4
> > fstat64(4, {st_mode=S_IFDIR|0755, st_size=48, ...}) = 0
> > fstat64(4, {st_mode=S_IFDIR|0755, st_size=48, ...}) = 0
> > fcntl64(4, F_GETFL)                     = 0x28800 (flags
> > O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW)
> > fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
> > close(3)                                = 0
> > fcntl64(4, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
> > fstat64(4, {st_mode=S_IFDIR|0755, st_size=48, ...}) = 0
> > getdents64(4, /* 2 entries */, 1024)    = 48
> > getdents64(4, /* 0 entries */, 1024)    = 0
> > fcntl64(4, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
> > openat(4, "..", O_RDONLY|O_LARGEFILE)   = 3
> > close(4)                                = 0
> > fstat64(3, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
> > unlinkat(3, "Child", AT_REMOVEDIR)      = 0
> > fstat64(3, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
> > fcntl64(3, F_GETFL)                     = 0x8000 (flags
> > O_RDONLY|O_LARGEFILE)
> > fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
> > fstat64(3, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
> > getdents64(3, /* 3 entries */, 1024)    = 80
> > openat(3, "Child", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW) =
> -1
> > ENOENT (No such file or directory)
> > getdents64(3, /* 0 entries */, 1024)    = 0
> > fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
>
> POSIX allows readdir to work that way.
>

Sorry I do not follow your comment. What way POSIX allows readdir to work ?


>
> I already suggested that making this change might help you:
>
> -    CONSECUTIVE_READDIR_UNLINK_THRESHOLD = 10
> +    CONSECUTIVE_READDIR_UNLINK_THRESHOLD = 1
>

I did not try above option. I will try this later tonight.



Shailesh Jain


reply via email to

[Prev in Thread] Current Thread [Next in Thread]