Recursive delete problem (Reposted:)

Urban Widmark urban at
Fri Jan 14 08:55:20 GMT 2000

On Fri, 14 Jan 2000, Grahame Bowland wrote:

> I believe I've found a problem that we can reproduce using the latest 
> samba release (2.0.6). It is fairly hard to describe accurately but I will 
> do my best. The bug is present if deleting from a smbmounted point
> under Linux or from Windows 98 through "Network Neighborhood."

smbmounted = smbfs, but you see the same thing from win98? Then this could
be all wrong.

I get the problems below when talking to NT4 or samba-2.0.?

> Consider a directory 'source' with two sub-directories, 'a' and 'b'.
> We have found that, even though all of the files and directories
> below and including 'source' have write permission set for members
> of 'ihgtech', 'rm -rf source/' fails with permission denied errors
> for the sub-directories.

You could try my smbfs-rm.patch (for 2.2.13, it should still work for
2.2.14, but maybe it won't apply cleanly) which you can get from:

Note that this is a highly experimental and unofficial thing ... (and I
haven't tested it myself as much as I would like, and not with 2.2.14). If
you do, please let me know if it works, or not.

The idea is:
'rm -rf' first reads the directory, this is cached by smbfs, then some
files are removed, smbfs then sets the cache to be invalid but rm -rf
remembers it's position in the cache. The cache is refilled, rm -rf now
points to entry 18 in the cache, believing that the first 17 has been
deleted. It therefore fails to remove all files from the dir, and the dir
is not empty and can not be removed.

If you only have very short directories you should be able to remove
those. Add one dir with a lot of files, it should fail on that.

> $ rpm -qa | grep samba
> samba-common-2.0.5a-12
> samba-client-2.0.5a-12
> samba-2.0.6-19991110

This looks like a nice mess, both 2.0.5a and 2.0.6 installed at the same
time ... (no, I don't think that is the cause of your problem).


More information about the samba mailing list