Deletion of symbolic links on NFS / Samba bug

This forum contains bug reports from previous beta tests - the issue has remained unresolved, either because it couldn't be reproduced, or couldn't be prevented/fixed

Moderators: white, sheep, Hacker, Stefan2

Post Reply
ericgur
Junior Member
Junior Member
Posts: 3
Joined: 2008-08-17, 06:55 UTC

Deletion of symbolic links on NFS / Samba bug

Post by *ericgur » 2008-08-17, 07:16 UTC

I'm using a shared file system (NFS / Samba) that is used by both Linux and Windows clients.
Like many Linux file systems, it has soft (symbolik) links to files and directories.
The correct behavior for deleting (or copying) such soft links is to delete (or copy) the link itself and not the actual file or dirctory pointed by the link.
The same behaviour of the UNIX command:
rm -fr <dir-names>
or
rm -fr <file-names>

It's very common that soft links point to other mounts and/or higher up the directory tree.
Deleting soft links like normal directories is extremely dangerous. The user is not always aware of exact directory structures.

Not having the option to delete or copy files on NFS is very crippling.

I'm using:
TC 7.04a
Window XP Pro SP3 fully patched
NFS access via Linux Samba servers.

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36425
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2008-08-18, 16:15 UTC

Total Commander handles links on NTFS drives correctly. Apparently Samba links cannot be detected this way, so TC sees them as normal files/folders. I don't think that there is any way to detect Samba links from Windows (or is there?), so all I can recommend is that you don't use any - you would see the same problem in Explorer too...
Author of Total Commander
http://www.ghisler.com

ericgur
Junior Member
Junior Member
Posts: 3
Joined: 2008-08-17, 06:55 UTC

Post by *ericgur » 2008-08-19, 06:19 UTC

Explorer is behaving similar to TC in this sense, it even displays an error which TC doesn't, but files are still deleted.

Sadly, I must use soft links (at work) so I need a workaround.
Is it possible for TC to call 'delete file' on network directories first as if they were files:
* Success -> this was a soft link
* Fail -> probably directory, delete directory like before.

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36425
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2008-08-20, 15:35 UTC

Well, that's EXACTLY what Total Commander already does! It tries to remove the directory, then verifies via FindFirstFile whether it's still there (some servers report success although they fail to delete the directory). If this happens, TC reports an error and offers to delete the contents of the non-empty directory.

Maybe your server still lists the directory even after the remove call, and deletes it with a longer delay? I don't currently see how to avoid that situation because the return value of the directory delete function is unreliable too...
Author of Total Commander
http://www.ghisler.com

ericgur
Junior Member
Junior Member
Posts: 3
Joined: 2008-08-17, 06:55 UTC

Post by *ericgur » 2008-08-21, 06:58 UTC

I'll try to solve this problem using my own code. If I'm successful, I'll post the code. I'll write a simple program that deletes files and directories over the network.

Post Reply