xattr
xattr copied to clipboard
Supporting for Windows
https://github.com/thought-machine/please/issues/1268
CC @asw101 @arschles @devigned
Might want to update this with a bit more information...
Seems NTFS has two ways to set attributes. Extended attributes can be added to the MFT (master file table) however they have limited size. This approach is also supported by FAT I believe. Alternative data streams is only supported by NTFS but allows unlimited data to be stored alongside the main file.
http://ntfs.com/ntfs_basics.htm
I doubt please would run into the size limitation of extended attributes, we only need to store 64 byte.
@AaLl86 , please explain about NTFS's capabilities/functionality @craigbarkhouse , please share your vision CC @brymat-msft
@billziss-gh , could you tell whether your support of file systems (I see that you are dealing with few Golang packages, which has something to do with file systems) allow to improve QA part?
@advancedwebdeveloper
@billziss-gh , could you tell whether your support of file systems (I see that you are dealing with few Golang packages, which has something to do with file systems) allow to improve QA part?
I am not sure I understand what you mean by "improve QA part".
To answer the original question: Windows does have Extended Attribute (EA) support. NTFS and I believe some versions of FAT support them. There is however a caveat: there is no Win32 API to access them and the NT API that exists is not documented.
The NT API consists of the functions NtQueryEaFile and NtSetEaFile and you can find information about them by searching online. I have example implementations of xattr functions using the NT API in the following places:
- In my port of fsx to Windows, which I use to test file systems.
- In a simple POSIX layer that is included with one of the WinFsp file systems: winposix.c. Please note that this EA code is not regularly tested.
I also note that Cygwin has a Linux-like implementation of xattr that uses the same NT API. You may want to have a look there as well.
One final note: you will find out that NTFS likes to uppercase extended attribute names (so that myxattr will become MYXATTR upon retrieval). Some POSIX layers deal with this by forcing all extended attribute names to be lowercase.
@advancedwebdeveloper
@billziss-gh , could you tell whether your support of file systems (I see that you are dealing with few Golang packages, which has something to do with file systems) allow to improve QA part?
I am not sure I understand what you mean by "improve QA part".
To answer the original question: Windows does have Extended Attribute (EA) support. NTFS and I believe some versions of FAT support them. There is however a caveat: there is no Win32 API to access them and the NT API that exists is not documented.
The NT API consists of the functions
NtQueryEaFileandNtSetEaFileand you can find information about them by searching online. I have example implementations ofxattrfunctions using the NT API in the following places:
- In my port of fsx to WIndows, which I use to test file systems.
- In a simple POSIX layer that is included with one of the WinFsp file systems: winposix.c. Please note that this EA code is not regularly tested.
I also note that Cygwin has a Linux-like implementation of
xattrthat uses the same NT API. You may want to have a look there as well.One final note: you will find out that NTFS likes to uppercase extended attribute names (so that
myxattrwill becomeMYXATTRupon retrieval). Some POSIX layers deal with this by forcing all extended attribute names to be lowercase.
I think uppercase can be resolved by things like base64 or hex encode
Interesting... never used this board before.
NTFS exposes EA capabilities through an attribute in the MFT record of the file. There are API exposed from the NT Kernel that allow you to directly retrieve this information, and as far as I know this functionality does not exists on FAT32 (I should double check).
What are the information that are not clear?
Andrea
On Tue, Oct 6, 2020 at 3:41 AM Ivan [email protected] wrote:
@AaLl86 https://github.com/AaLl86 , please explain about NTFS's capabilities/functionality
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pkg/xattr/issues/47#issuecomment-704184213, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWOGBUEKR6QQXEYWFD67TDSJLX35ANCNFSM4SEJVAOQ .
-- Andrea Allievi Blog owner www.andrea-allievi.com
So, any progress here?
Hey guys (@lygstate @Tatskaari @advancedwebdeveloper @AaLl86), it's been a while (we have 2024 ;-)) Do you want to keep this issue open? Is anyone (at least) prototyping the feature?
We have no plans to support windows in Please at the moment, so have no need of this feature.
Ok, I'm closing this one, so far.