[Samba] Re: Symlinks deletion behaviour
forsmb at mail.ru
Mon Mar 19 11:36:23 GMT 2007
Further investigation with strace shows that Samba tries to use rmdir() syscall to delete the link which naturally fails with "Not a directory" as it should according to man.
However, looking at usual "rm -r" behaviour shows that it uses unlink(). Samba does not (while there's some SMB_VFS_UNLINK) in rmdir_internals. Is there any bug or a feature which I don't realize?
From: Alexander <forsmb at mail.ru>
To: samba at lists.samba.org
Date: Sun, 18 Mar 2007 23:59:12 +0300
Subject: Symlinks deletion behaviour
> Hi List, hi Samba-team,
> Recently I've faced some problem with directories deletion trough Samba and trying to clarify the root cause. The following happens:
> 1. There is a directory my_dir and symlink to it my_dir_link
> drwxrwsr-x 48 myuser mygroup 20480 Mar 18 21:53 .
> drwxr-xr-x 33 root root 0 Feb 28 17:37 ..
> drwxr-sr-x 2 myuser mygroup 4096 Mar 18 21:47 my_dir
> lrwxrwxrwx 1 myuser mygroup 57 Mar 18 21:53 my_dir_link -> /test/my_dir/
> 2. When I try to delete my_dir_link via Windows Explorer (under myuser who is a memeber of mygroup) I get "Cannot remove folder my_dir_link: The directory name is invalid". At the same time all files from my_dir_link(=my_dir) being deleted ok. My_dir can be deleted without any problem
> In the log I see the following:
> [2007/03/18 23:50:42, 5] smbd/filename.c:unix_convert(108)
> unix_convert called on file "test/my_dir_link"
> [2007/03/18 23:50:42, 3] smbd/reply.c:rmdir_internals(3923)
> rmdir_internals: couldn't remove directory test/my_dir_link : Not a directory
> [2007/03/18 23:50:42, 3] smbd/error.c:unix_error_packet(91)
> unix_error_packet: error string = Not a directory
> [2007/03/18 23:50:42, 3] smbd/error.c:error_packet(147)
> error packet at smbd/trans2.c(2592) cmd=1 (SMBrmdir) NT_STATUS_NOT_A_DIRECTORY
> Share is defined as follows:
> path = /share
> force user = myuser
> force group = mygroup
> read only = No
> strict allocate = Yes
> printable = no
> follow symlinks = Yes
> wide links = Yes
> So, is it an expected behaviour, bug or something? Any clue is highly appreciated. I'm using Samba 3.0.20b from SLES9, but testing showed the same behaviour on 3.0.22 as well.
More information about the samba