I have written a short shell script that simply wraps
setfattr in a slightly more convenient form for setting the extended attribute that corresponds to a free-text comment:
#!/bin/sh test "$2" && setfattr -n user.xdg.comment -v "$2" "$1" getfattr -d -m '^user.xdg.comment$' "$1"
For storing US ASCII comments as xattrs, this works great. However, if I try to set a comment that contains non US ASCII characters, it gives me back what appears to be Base64 encoded data:
$ touch xyz $ set-comment xyz åäöåä # file: xyz user.xdg.comment=0sw6XDpMO2w6XDpA== $
But it isn't just Base64:
$ printf "0sw6XDpMO2w6XDpA==" | \base64 --decode ��:\:L;l:\:@base64: invalid input $
Most of the time, I get just random-looking garbage back. Some times, like this, the Base64 decoder throws "invalid input" back at me.
What is this string? What is its relationship to the original input value? How do I go from what
getfattr gives me back to the original input value (such as
åäöåä in this case)?
setfattr --version on my system responds with
setfattr 2.4.46. I'm running the version packaged by Debian Wheezy. In the unlikely event that it matters, I'm running ZFS On Linux 0.6.3 (saw the same behavior with 0.6.2 as well) on the stock Wheezy kernel.