Moving files on Samba Share sets hidden+system Attributes
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 24
- Joined: 2009-07-05, 08:05 UTC
Moving files on Samba Share sets hidden+system Attributes
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
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
- ghisler(Author)
- Site Admin
- Posts: 50840
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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...
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
https://www.ghisler.com
-
- Junior Member
- Posts: 24
- Joined: 2009-07-05, 08:05 UTC
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
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
- ghisler(Author)
- Site Admin
- Posts: 50840
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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.

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
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50840
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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
https://www.ghisler.com
-
- Junior Member
- Posts: 24
- Joined: 2009-07-05, 08:05 UTC
- ghisler(Author)
- Site Admin
- Posts: 50840
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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
https://www.ghisler.com
-
- Junior Member
- Posts: 24
- Joined: 2009-07-05, 08:05 UTC
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.
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.
- ghisler(Author)
- Site Admin
- Posts: 50840
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Thanks, I will try with the "map hidden" etc. switches.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50840
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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...
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
https://www.ghisler.com
-
- Junior Member
- Posts: 24
- Joined: 2009-07-05, 08:05 UTC
-
- Junior Member
- Posts: 24
- Joined: 2009-07-05, 08:05 UTC
- ghisler(Author)
- Site Admin
- Posts: 50840
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact: