[Samba] Cannot remove symlink with missing target
Jeremy Allison
jra at samba.org
Wed Jan 6 18:28:14 UTC 2016
On Wed, Jan 06, 2016 at 06:36:50PM +0100, Andreas Maier wrote:
> Hi,
> I have started using symbolic links on an SMB share and find that
> symbolic links whose target no longer exists cannot be removed on
> the client side.
>
> Example, on the SMB client side in an SMB-mounted directory:
>
> 1. Create a file and a relative symlink to it:
>
> $ touch a
> $ ln -s a b
> $ ls -l
> total 0
> -rw-rw-r--. 1 andi andi 0 Jan 6 14:42 a
> lrwxrwxrwx. 1 andi andi 1 Jan 6 14:42 b -> a
>
> 2. Removing the symlink target causes removal of symlink to fail:
>
> $ rm a
> $ ls -l
> total 0
> lrwxrwxrwx. 1 andi andi 1 Jan 6 14:42 b -> a
> # With colors on, the b and a are now marked red, indicating a
> broken symlink
> $ rm b
> rm: cannot remove ‘b’: No such file or directory
> $ ls -l
> total 0
> lrwxrwxrwx. 1 andi andi 1 Jan 6 14:42 b -> a
>
> 3. Reestablishing the symlink target causes removal of symlink to
> work again:
>
> $ touch a
> $ ls -l
> total 0
> -rw-rw-r--. 1 andi andi 0 Jan 6 14:44 a
> lrwxrwxrwx. 1 andi andi 1 Jan 6 14:42 b -> a
> $ rm b
> $ ls -l
> total 0
> -rw-rw-r--. 1 andi andi 0 Jan 6 14:44 a
>
> The same test when performed on a local file system, works fine
> (i.e. the broken symlink can successfully be removed).
>
> I have debugged this on the server side by enabling debug logs in
> the Synology NAS, and the relevant portion during the "rm b" command
> on the broken symlink is (the directory is Projects/xx/try1,
> relative to the SMB share):
Can't reproduce this on latest 4.3.x (and I just tried).
We did have such a bug, but I remember fixing it :-).
What Samba version is running on the Synology ?
More information about the samba
mailing list