Builds and runs on mac and linux, passes tests on linux and vista. Fixes http://bugs.winehq.org/show_bug.cgi?id=15679
It's worth discussing a bit before posting to wine-patches. This patch uses filesystem extended attributes to store the win32 attribute bits. These are available fairly widely finally - I think current Linux, Mac, and Solaris all support some form of extended attributes.
Because the extended attribute API varies somewhat wildly between operating systems, I went whole-hog and used autoconf to detect the differences between the api on linux and macosx. Somebody else should be able to add solaris support without much difficulty if this is approved.
The convention chosen is that the win32 file attributes are stored as a four digit hex number in the extended attribute named user.wine.attr. (The 'user' prefix is suggested by http://www.freedesktop.org/wiki/CommonExtendedAttributes .)
For backwards compatibility, if a native file lacks extended attributes; it is reported as having ARCHIVE attribute. Likewise, if a file just has the ARCHIVE attribute set, there is no native extended attribute.
Here's an example: touch foo.dat wine cmd /c attrib -a foo.dat xattr -l foo.dat This outputs user.wine.attr: 0000
i.e. because the file has anything but the default attribute, we store the entire win32 attribute bitmask in the extended attribute.
Another example: touch bar.dat wine cmd /c attrib +s bar.dat xattr -l bar.dat This outputs user.wine.attr: 0024 or ARCHIVE | SYSTEM.
This convention should be thought over carefully before we go with it. I also considered using individual xattrs for each attribute bit, but discarded that idea as adding overhead and complexity without any obvious payoff.
Finally, the implementation of attrib in cmd is lame -- it only handles two arguments. It's enough for the moment, but the real attrib can handle multiple attribute flags, and we should support that sometime.
So, what do folks think? - Dan
Dan Kegel dank@kegel.com writes:
The convention chosen is that the win32 file attributes are stored as a four digit hex number in the extended attribute named user.wine.attr. (The 'user' prefix is suggested by http://www.freedesktop.org/wiki/CommonExtendedAttributes .)
You should use the user.DosAttrib format defined by Samba.