I now have a single directory created by a MacOS client and called "FROM_MAC_OS". The dir is tagged "green".
Let's see the extended attributes on the dir:
Code:
lsextattr user FROM_MAC_OS
FROM_MAC_OS org.netatalk.Metadata DosStream.com.apple.metadata_kMDItemUserTags:$DATA
OK. I think this means, that the dir has two extended attributes:
- org.netatalk.Metadata
- DosStream.com.apple.metadata_kMDItemUserTags:$DATA
I can get the data in org.netatalk.Metadata like this:
Code:
getextattr -s user org.netatalk.Metadata FROM_MAC_OS
FROM_MAC_OS "\000\^E\^V\000\^B\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\00\000\000\000\^D\000\000\000\M^Z\000\000\000\000\000\000\00\000\000\^Ab\000\000\000\^P\000\000\000\011\000\000\000z\000\000\000\040\000\000\000\^N\000\000\^Ar\000\000\000\^D\M^@DEV\000\000\^Av\000\000\000\000\M^@INO\000\000\^A~\000\000\000\000\M^@SYN\000\000\^A\M^F\000\000\000\000\M^@SV~\000\000\^A\M^N\000\000\000\000\000\000\000\000\000\000\000\000\000\^D\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000$\^O\M-7d$\^O\M-7d\M^@\000\000\000$\^O\M-7d\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
It's my impression, that the data I'm after, is in
DosStream.com.apple.metadata_kMDItemUserTags:$DATA
, so I'll read the data (Remember to put name in single quotes or escape the $):
Code:
getextattr -s user 'DosStream.com.apple.metadata\042_kMDItemUserTags:$DATA' FROM_MAC_OS
FROM_MAC_OS "bplist00\M-!\^AWGreen\012\012\000\000\000\000\000\000\^A\^A\000\000\000\000\000\000\000\^B\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\^R"
Let's see, what happens if I change the tag from "green" to "red":
Code:
getextattr -s user 'DosStream.com.apple.metadata\042_kMDItemUserTags:$DATA' FROM_MAC_OS
FROM_MAC_OS "bplist00\M-!\^AURed\012\012\000\000\000\000\000\000\^A\^A\000\000\000\000\000\000\000\^B\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\^P"
Great, I have the right extended attribute for sure, and I can read the data. Now, if I copied the data in the extended attribute in another dir, I should be able to change the tag of the other dir.
Get the original data (Like I did before):
Code:
getextattr -s user 'DosStream.com.apple.metadata\042_kMDItemUserTags:$DATA' FROM_MAC_OS
FROM_MAC_OS "bplist00\M-!\^AURed\012\012\000\000\000\000\000\000\^A\^A\000\000\000\000\000\000\000\^B\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\^P"
Set the same data on currently untagged dir "UNTAGGED" (Remember single quotes on attribute name and data?):
Code:
setextattr user 'DosStream.com.apple.metadata\042_kMDItemUserTags:$DATA' 'bplist00\M-!\^AURed\012\012\000\000\000\000\000\000\^A\^A\000\000\000\000\000\000\000\^B\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\^P' UNTAGGED
Read the extended attribute we just set on dir "UNTAGGED":
Code:
getextattr -s user 'DosStream.com.apple.metadata\042_kMDItemUserTags:$DATA' UNTAGGED
UNTAGGED "bplist00\134M-!\134^AURed\134012\134012\134000\134000\134000\134000\134000\134000\134^A\134^A\134000\134000\134000\134000\134000\134000\134000\134^B\134000\134000\134000\134000\134000\134000\134000\134000\134000\134000\134000\134000\134000\134000\134000\134^P"
It did not work, what I read from "UNTAGGED" is not what I have in "FROM_MAC_OS". Specifically, all occurrences of '\' have been translated to '\134'.
Let's see the difference between the original data and the copy in hex:
Code:
getextattr -x user 'DosStream.com.apple.metadata\042_kMDItemUserTags:$DATA' FROM_MAC_OS
FROM_MAC_OS 62 70 6c 69 73 74 30 30 a1 01 55 52 65 64 0a 36 08 0a 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
getextattr -x user 'DosStream.com.apple.metadata\042_kMDItemUserTags:$DATA' UNTAGGED
UNTAGGED 62 70 6c 69 73 74 30 30 5c 4d 2d 21 5c 5e 41 55 52 65 64 5c 30 31 32 5c 30 31 32 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 5e 41 5c 5e 41 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 5e 42 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 30 30 30 5c 5e 50
Any suggestion on how I can feed the data to setextattr in the right way? It seems to want a string. I can read the data as HEX, but setextattr needs a string. Could it be a ASCII/Unicode problem? Maybe I'm feeding ASCII when Unicode is expected?
Thanks,
Tobias