cifs mounts: unable to move dangling symlinks (case of svn ceckout with symlinks)

Bug #117727 reported by casbon
16
Affects Status Importance Assigned to Milestone
samba
Fix Released
Medium
samba (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: smbfs

Sometimes, a cifs mount refuses to remove an empty directory. It can easily be removed on the samba server, but not on the client.

james@palermo:~/lib/.svn$ mount
...
//newyork/james on /home/james type cifs (rw,mand)
...
james@palermo:~/lib/.svn$ ls -al tmp/
total 0
drwxr-xr-x 2 james james 0 2007-05-30 11:22 .
drwxr-xr-x 3 james james 0 2007-05-30 11:22 ..
james@palermo:~/lib/.svn$ rm tmp/
rm: cannot remove `tmp/': Is a directory
james@palermo:~/lib/.svn$ rmdir tmp/
rmdir: tmp/: Directory not empty
james@palermo:~/lib/.svn$ rm -rf tmp/
rm: cannot remove directory `tmp/': Directory not empty

Revision history for this message
casbon (casbon) wrote :
Revision history for this message
casbon (casbon) wrote :

This seems to be due to the fact that samba refuses to show dangling symlinks:

james@palermo:~$ mkdir test1
james@palermo:~$ touch test1/dest
james@palermo:~$ ln -s test1/dest test1/link
james@palermo:~$ rm test1/dest
james@palermo:~$ ls -l test1/
total 0
james@palermo:~$ rmdir test1
rmdir: test1: Directory not empty

Revision history for this message
Mathias Gug (mathiaz) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Could you specify which version of smbfs you're using ?

Changed in samba:
status: New → Incomplete
Revision history for this message
casbon (casbon) wrote :

version on client: 3.0.24-2ubuntu1

version of samba on server: 3.0.22-1ubuntu3

Revision history for this message
Mathias Gug (mathiaz) wrote : Re: [Bug 117727] Re: cifs mounts: unable to remove empty directory

I cannot reproduce your problem here.

On Thu, Sep 20, 2007 at 10:54:29AM -0000, casbon wrote:
> version on client: 3.0.24-2ubuntu1
>
> version of samba on server: 3.0.22-1ubuntu3
>

Could you try updating to the latest version of samba ? The versions
you've reported are not the latest security updates for both feisty and
dapper.

Revision history for this message
casbon (casbon) wrote : Re: cifs mounts: unable to remove empty directory

I updated the packages to the latest for dapper ( samba 3.0.22-1ubuntu3.3) and feisty (3.0.24-2ubuntu1.2).

Still seeing the problem:

james@palermo:~$ mkdir bug
james@palermo:~$ touch bug/real
james@palermo:~$ ln -s bug/real bug/link
james@palermo:~$ rm bug/real
james@palermo:~$ ls -l bug/
total 0
james@palermo:~$ rm -rf bug/
rm: cannot remove directory `bug/': Directory not empty
james@palermo:~$ rm bug/link
james@palermo:~$ rm -rf bug/
james@palermo:~$

Revision history for this message
Mathias Gug (mathiaz) wrote :

Can you post the smb.conf file from the dapper server ? and the line that mounts the cifs share in fstab in the feisty client ?

Revision history for this message
casbon (casbon) wrote :
Revision history for this message
casbon (casbon) wrote :

Its mounted through pam mount, not fstab:

in /etc/security.d/pam_mount:
volume * cifs newyork & /home/& severino - -

from mount command:
//newyork/james on /home/james type cifs (rw,mand)

Revision history for this message
Mathias Gug (mathiaz) wrote : Re: [Bug 117727] Re: cifs mounts: unable to remove empty directory

On Fri, Sep 21, 2007 at 04:41:24PM -0000, casbon wrote:
> Its mounted through pam mount, not fstab:
>
> in /etc/security.d/pam_mount:
> volume * cifs newyork & /home/& severino - -
>
> from mount command:
> //newyork/james on /home/james type cifs (rw,mand)
>

Could you try with an fstab entry or manually mounting the share ?

Revision history for this message
casbon (casbon) wrote : Re: cifs mounts: unable to remove empty directory

Still the same problem:
james@palermo:/mnt$ tail -1 /etc/fstab
//newyork/james /mnt/test cifs user=james
james@palermo:/mnt$ sudo mount test/
Password:
james@palermo:/mnt$ cd test/
james@palermo:/mnt/test$ mkdir bug
james@palermo:/mnt/test$ touch bug/real
james@palermo:/mnt/test$ ln -s bug/real bug/link
james@palermo:/mnt/test$ rm bug/real
james@palermo:/mnt/test$ ls bug/
james@palermo:/mnt/test$ rm -rf bug/
rm: cannot remove directory `bug/': Directory not empty
james@palermo:/mnt/test$ rm bug/link
james@palermo:/mnt/test$ rm -rf bug/

Revision history for this message
Mathias Gug (mathiaz) wrote :

Looking at your smb.conf file, you've enabled the option "hide unreadable" in the general section :

[global]

..

hide unreadable = yes

That's the reason why dangling symlinks are not listed on the client.

Changed in samba:
status: Incomplete → Invalid
Revision history for this message
casbon (casbon) wrote :

Ok thanks, that shows the link. Unfortunately, now I cannot move a broken symlink.

james@palermo:~/bug$ rm *
james@palermo:~/bug$ touch real
james@palermo:~/bug$ ln -s real link
james@palermo:~/bug$ rm real
james@palermo:~/bug$ mv link link2
mv: cannot move `link' to `link2': No such file or directory
james@palermo:~/bug$ ls -l
total 0
lrwxrwxrwx 1 james james 4 2007-09-23 20:48 link -> real

BTW - why I am trying to do this? svn does not work on cifs partitions because of this error. If it checks out a directory with links in, it moves the real file before the link, and the breaks because the link won't move.

Revision history for this message
Mathias Gug (mathiaz) wrote :

I can reproduce your problem. Thanks for giving the reason why you're trying to do that.

nfs doesn't have this problem. Could you use nfs instead of cifs to mount your home from your client ?

Changed in samba:
importance: Undecided → Low
status: Invalid → Triaged
Revision history for this message
Laurent Dinclaux (dreadlox) wrote :

Using NFS is not a fix but a workaround and NFS is not to be not so secure....

CIFS has broken symlink support as I can browse the symlinks using nautilus (smb://) and not using CIFS (for the same share)

Revision history for this message
spencerrecneps (spencerjgardner) wrote :

Has anything ever been done with this bug? I'm running into the same issue and can't find a satisfactory response anywhere online.

Revision history for this message
Fredrik Persson (frepe) wrote :

I am experiencing this same bug right now. Has anything been done to correct it? I have not been able to find a solution online either.

Revision history for this message
Marcerino (mastervanleeuwen) wrote :

I've also exprienced this problem, although for a different reason. The problem seems to have been fixed in recent versions (3.3.x) of samba. See:
https://bugzilla.samba.org/show_bug.cgi?id=6090

I tested removing dangling symlinks using Ubuntu 8.10 (Intrepid Ibex) as a server and that seems to work. As far as I understand, that should mean that moving them also works.

As an aside: I am interested in this issue because I would like to pam_mount homedirs using cifs. firefox creates a lock file that is a dangling symlink. If the lock file cannot be removed, firefox cannot be started...

Revision history for this message
casbon (casbon) wrote : Re: [Bug 117727] Re: cifs mounts: unable to move dangling symlinks (case of svn ceckout with symlinks)

2009/4/10 Marcerino <email address hidden>:
> As an aside: I am interested in this issue because I would like to
> pam_mount homedirs using cifs. firefox creates a lock file that is a
> dangling symlink. If the lock file cannot be removed, firefox cannot be
> started...

Last time I tried firefox uses sqlite, which thinks all databases are
locked if they're opened on cifs.

Revision history for this message
Thierry Carrez (ttx) wrote :

This should have been fixed in 3.3.1, so the problem should be gone in Jaunty.
Could anyone affected please confirm that this is fixed in Jaunty ?

Changed in samba:
status: Unknown → In Progress
Revision history for this message
lordlaurin (lordlaurin) wrote :

I've just upgraded to Jaunty and I am still experiencing this problem.

Revision history for this message
cult_hero13 (cult-hero13) wrote :

I have a samba server set up on a very up-to-date build of Gentoo and am accessing it using a samba client on SuSE 10.0 OSS. I have the exact same problem with Firefox and Thunderbird lock files not being removed.

I can also replicate it by creating a file, creating a symlink to it, then removing the file. I will not be able to remove the symlink on the client side, but I can on the server.

Jelmer Vernooij (jelmer)
Changed in samba (Ubuntu):
status: Triaged → Fix Released
Changed in samba:
status: In Progress → Fix Released
Changed in samba:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.