The Samba-Bugzilla – Bug 4978
Store DOS Attributes fails when copying folders
Last modified: 2007-11-12 12:50:36 UTC
Our samba server has been configured with the "Store DOS Attributes" option for a some time now (instead of the old x bit mapping method). However, I was doing some file admin tasks today and discovered a serious problem...
When accessing samba shares using Windows Explorer, I noticed that *folder* archive, system and hidden attributes are *lost* after a copy operation! I know my setup is fine as I can manually change these flags using the Windows Explorer folder property dialog. This problem also rears its ugly head when running batch files containing XCOPY /s commands so it is not just a Windows Explorer issue.
File attributes seem to copy okay so I would focus attention on *folders* only. We still have an old NT server on-hand and it does *not* have this problem.
Is it possible that this bug is a throwback to the x-bit mapping method which only worked for files (not folders). Perhaps when the EA mechanism was introduced, someone forgot to modify the "folder copy/create" routine which was previously expected to disregard *folder* attributes. I know nothing about the underlying SMB/CIFS protocol so this is just a wild guess....sorry if I'm way off the mark.
To put this bug in context, it is now pretty common practice to hide application folders on Windows shares to prevent accidental deletion of critical files to which users must have write access. Our payroll application also expects faithful behaviour vis-a-vis the archive flag. It is simply not practical to have to go around fixing these folder flags manually.
We use Debian Etch with Samba 3.0.23 and Windows XP clients and, apart from this particular problem, we have a very reliable setup.
Created attachment 2931 [details]
Patch attached. Will be fixed in 3.0.x (next release) and 3.2.0 and beyond.
(In reply to comment #2)
> Patch attached. Will be fixed in 3.0.x (next release) and 3.2.0 and beyond.
> Thanks !
Thanks for quick action, Jeremy.
BTW, This may a duplicate of https://bugzilla.samba.org/show_bug.cgi?id=4385
As a temporary workaround until fix arrives, I would suggest using WinZip, whose compress and extract phases preserve folder attributes (but watch out for folders starting with a dot, which XP's bundled version of WinZip ignores!). If you have convenient access to the Samba server, use a recent version of the star utility (by Jorg Schilling) in -copy mode with the -p and -xattr options.
*** Bug 4385 has been marked as a duplicate of this bug. ***