Web lists-archives.com

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




On 1/4/2018 3:52 PM, Chris Murphy via samba wrote:
client:  samba-client-4.7.4-0.fc27.x86_64
client:  samba-client-4.6.5-0.fc26.x86_64
server:  samba-4.7.3-3.fc27.x86_64

Reproduce steps:

[chris@f27h ~]$ smbclient //f27s.local/scratch/
Enter SAMBA\chris's password:
Try "help" to get a list of possible commands.
smb: \> cd noperms
smb: \noperms\> ls
   .                                   D        0  Wed Jan  3 12:00:27 2018
   ..                                  D        0  Wed Jan  3 19:33:01 2018
   test2                               D        0  Wed Jan  3 11:59:55 2018
   test3                               D        0  Wed Jan  3 11:59:55 2018
   test4                               D        0  Wed Jan  3 11:59:55 2018
   test1                               D        0  Wed Jan  3 11:59:55 2018

         1073739776 blocks of size 1024. 503895948 blocks available
smb: \noperms\> rmdir test1
smb: \noperms\> ls
   .                                   D        0  Wed Jan  3 12:00:27 2018
   ..                                  D        0  Wed Jan  3 19:33:01 2018
   test2                               D        0  Wed Jan  3 11:59:55 2018
   test3                               D        0  Wed Jan  3 11:59:55 2018
   test4                               D        0  Wed Jan  3 11:59:55 2018
   test1                               D        0  Wed Jan  3 11:59:55 2018

         1073739776 blocks of size 1024. 503895948 blocks available
smb: \noperms\>

Expected results:

Either test1 should be deleted, or there should be an error why it's
not deleted. I'm not sure if directories with items in them can even
be deleted with smbclient, but nevertheless there should be an error.
Even when enabling debug with -d 10, there is no error.

smb: \noperms\> rmdir test1
dos_clean_name [\noperms\test1]
unix_clean_name [\noperms\test1]
smb: \noperms\>

For what it's worth, when I try to remove this same directory on macOS
10.13 or Windows 10, it is deleted. Whereas with GNOME Nautilus, it is
likewise not deleted (same results as smbclient, it's not deleted and
there's no error.) So I'm not sure yet if there is a wider bug here
that affects libsmbclient or what. I've filed a bug about that here:

https://bugzilla.gnome.org/show_bug.cgi?id=792147

That bug contains attachments for the server and client smb.conf and
some other stuff.


Chris,

    I would assume you would need to use 'rm -r' to remove a directory and it's contents. I would also assume a error message would be expected with 'rmdir' if the dir was not empty. The man page for smbclient also suggests you may use 'deltree'.

--
--
James


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba