Moving files on Samba Share sets hidden+system Attributes

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Alexander77
Junior Member
Junior Member
Posts: 24
Joined: 2009-07-05, 08:05 UTC

Moving files on Samba Share sets hidden+system Attributes

Post by *Alexander77 »

When moving one ore more files from one location of a samba share to another location on the same samba share, the "hidden" and "system" attributes of the moved files are set without any understandable reason.

This behavior does appear when:
- using TC 7.5bx
- moving with drag & drop
- moving with F6
- moving between the two panels
- moving within one panel into a subfolder

This behavior does NOT appear when:
- copying files
- using TC 7.04a
- moving a directory containing files
- moving between a harddrive and a samba share
- moving between harddrives
- moving between different samba shares

I tested this with samba v3.0.30, but it seems not to be a samba issue, as it works perfectly with TC 7.04a.

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

Post by *ghisler(Author) »

This seems to be a duplicate report:
http://ghisler.ch/board/viewtopic.php?t=22750

There seems to be an error in the implementation of GetFileAtrributes on Samba servers. TC 7.04a wasn't calling this function, it was added to handle the failure of moving files with certain attributes...
Author of Total Commander
https://www.ghisler.com
Alexander77
Junior Member
Junior Member
Posts: 24
Joined: 2009-07-05, 08:05 UTC

Post by *Alexander77 »

Sorry for the duplicate report!
Obviously Windows Explorer does not use GetFileAtrributes as it moves files on the same samba share corectly. If MS can do it correctly, TC should also be able to do so (or even better).
Is there any chance to get this fixed? I confess, I have absolutely no clue how to influence samba to give correct results for GetFileAtrributes.

As I had never experienced any other issues with attributes before, I would prefer to use the old method without GetFileAtrributes. Wouldn't it be possible to turn off the use of GetFileAtrributes optionally (maybe via a configuration option) to support these "broken" network drives as well? It seems there are several appliances out there which suffer this issue...

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

Post by *ghisler(Author) »

I tried with a (very old) samba version, but renaming files or moving them within the same server didn't cause the attribute error. :(

Since you write that the atttributes are OK in the file list (FindFirstFile), I will use that instead of GetFileAttributes.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50840
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have no idea whether this is fixed now or not, because my Samba test server doesn't have this bug. Therefore if you had this problem, please test whether it's still there with beta 7!
Author of Total Commander
https://www.ghisler.com
Alexander77
Junior Member
Junior Member
Posts: 24
Joined: 2009-07-05, 08:05 UTC

Post by *Alexander77 »

Unfortunately I have to report, that the problem still exists in v7.50 public beta 7.
If there is any information or test I can support you with, please, let me know.

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

Post by *ghisler(Author) »

I have installed Samba 3.2.3 on Ubuntu now, and I CANNOT reproduce the error. Maybe it really is a Samba bug of that specific version? Do you have the possibility to test this with a newer Samba version?
Author of Total Commander
https://www.ghisler.com
Alexander77
Junior Member
Junior Member
Posts: 24
Joined: 2009-07-05, 08:05 UTC

Post by *Alexander77 »

I compiled Samba v3.0.30, v3.2.12 and v 3.3.6. The problem still exists in all these versions.
Maybe it is a configuration issue. My Samba configuration file contains the following entries:

create mask = 777
directory mask = 777
map hidden = Yes
map system = Yes
map archive = Yes

This is necessary to allow setting hidden/system/archive attributes on the samba share (if explicitly set). If I disable these settings, no hidden and system bit can be set at all (which is not desirable in my opinion) and of course moving of files cannot lead to setting of attributes.

Would it be helpful if I provide a VMWare virtual machine with a running samba server, so that you could reproduce this issue?

Unfortunately I am not familiar with Ubuntu, but I will try to set up Samba on Ubuntu too. Maybe it gives me some clue.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50840
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks, I will try with the "map hidden" etc. switches.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50840
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I could finally reproduce it now, thanks for the Samba switches!

The reason is a Samba bug: When the option XPMoveMethod=1 is set in wincmd.ini (which it is by default on Windows XP and newer), TC will get the security attributes of the target folder and apply them to the target file on NTFS drives. The problem is that Samba drives identify themselves as NTFS too, but strange things happen when actual NTFS functions are called!

In this specific case, TC calls SetFileSecurity to apply the security attributes to the file. Unfortunately this causes Samba to change the file attributes to hidden and system. The solution is quite easy - I'm setting the attributes again with SetFileAttributes after copying the file security attributes.

In the meantime, you can avoid this behaviour by adding
XPMoveMethod=0
to your wincmd.ini under [Configuration]. But then files moved between two directories on NTFS drives will also keep their previous security attributes instead of inheriting those of the target folder...
Author of Total Commander
https://www.ghisler.com
Alexander77
Junior Member
Junior Member
Posts: 24
Joined: 2009-07-05, 08:05 UTC

Post by *Alexander77 »

I can confirm that setting "XPMoveMethod=0" resolves the unwanted behaviour.
I am looking forward to the next beta version of TC.

Thanks,
Alexander
Alexander77
Junior Member
Junior Member
Posts: 24
Joined: 2009-07-05, 08:05 UTC

Post by *Alexander77 »

In Public Beta 8 the unwanted behaviour is definitly fixed (even when the XPMoveMethod is not set to 0 manually).

Thanks for the support,
Alexander
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50840
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Great, thanks for trying it!
Author of Total Commander
https://www.ghisler.com
Post Reply