[Samba] smbclient, cannot delete non-empty directory, no error message

Chris Murphy lists at colorremedies.com
Fri Jan 5 18:15:54 UTC 2018


On Fri, Jan 5, 2018 at 6:37 AM, lingpanda101 <lingpanda101 at gmail.com> wrote:

>     I would assume you would need to use 'rm -r' to remove a directory and
> it's contents.

That doesn't work and the man page doesn't list flags for any
commands, plus it looks like rm is strictly for files not for
directories.

smb: \noperms\> rm -r test1
NT_STATUS_NO_SUCH_FILE listing \noperms\-r

smb: \noperms\> rm test2
NT_STATUS_NO_SUCH_FILE listing \noperms\test2


>I would also assume a error message would be expected with
> 'rmdir' if the dir was not empty.

This is a problem for gvfs-smb backend for GNOME which uses rmdir. Due
to the silent failure, gvfs-smb assumes it succeeds, but it doesn't.
gvfs-smb uses libsmbclient and so it really needs an error message to
know that the command did not succeed and that it needs to fall back
on other commands to complete the user action.

Basically right now GNOME users can't delete directories that have
files in them, that's pretty remarkable and not in a good way.

Should I file a bug? This problem goes back over a year at the least,
I'm rather surprised no one has run into this until now.


>The man page for smbclient also suggests
> you may use 'deltree'.

That does work.

Is there a reason for rmdir to exist? It sounds like deltree will
remove either an empty or full directory, which makes rmdir
superfluous/legacy.


-- 
Chris Murphy



More information about the samba mailing list