Symlinks deletion behaviour

Alexander forsmb at mail.ru
Tue Mar 20 08:01:03 GMT 2007


Hi samba-technical,

Since I didn't get anything in samba list, probably you can give any clue?

This issue is really important for us as it blocks some of our developers' scripts from deleting temporary data. So, any suggestion is really highly appreciated!

The general question is - can Samba delete symlinks to directories (as it does with such to files) or it is impossible by design?

Alexander

-----Original Message-----
From: Alexander <forsmb at mail.ru>
To: samba at lists.samba.org
Date: Mon, 19 Mar 2007 14:36:23 +0300
Subject: Re: Symlinks deletion behaviour

> 
> Hi all,
> 
> 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?
> 
> Regards,
> Alexander
> 
> -----Original Message-----
> 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:
> > [Test.Share]
> >         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.
> > 
> > Regards,
> > Alexander
> > 
> 


More information about the samba-technical mailing list