-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xattr.Getxattr always returns empty string #1
Comments
You are consuming the error, can you please try again and print the error if not nil, it may give us a clue what is going on. On 10/04/2012, at 14:08, bitcartelreply@reply.github.com wrote:
|
value, myerr := xattr.Getxattr(file, name) results in: value = On 4/9/12 9:14 PM, Dave Cheney wrote:
|
Thanks, I'll take a look this evening. For comparison could you post the output of xattr. On 10/04/2012, at 14:43, bitcartelreply@reply.github.com wrote:
|
which xattr xattr -l testfile Thx. On 4/9/12 9:54 PM, Dave Cheney wrote:
|
Hello, sorry I haven't replied yet, I hope to have some time to look at this issue on the weekend. |
That's cool, thanks. On 4/12/12 5:49 AM, Dave Cheney wrote:
|
..to fix this issue for darwin (macosx), you just need to consume Errno(0) in syscall_darwin.go func getxattr(path string, name string, value *byte, size int, pos int, options int) (r int, e error) {
if r0, _, e1 := syscall.Syscall6(syscall.SYS_GETXATTR, uintptr(unsafe.Pointer(syscall.StringBytePtr(path))), uintptr(unsafe.Pointer(syscall.StringBytePtr(name))), uintptr(unsafe.Pointer(value)), uintptr(size), uintptr(pos), uintptr(options)); e1 != syscall.Errno(0) {
e = e1
} else {
r = int(r0)
}
return
} |
I can confirm @kuba-- answer. You have to check for |
Nudge. As it is the code won't work on darwin. |
@avg-I: two years ago I made some improvements in my repo: https://github.com/kuba--/xattr |
@kuba-- thank you for letting me know! I've created a pull request against your repo with a commit that adds freebsd support kuba--/xattr#1. The change should be applicable to this repo as well (modulo |
Hi,
Using Mac OS X 10.7.3 and Go 1
From the example and my own tests, both writing and deleting a key-value pair succeeds (confirmed with /usr/bin/xattr).
However, Getxattr always returns an empty value.
Thanks.
The text was updated successfully, but these errors were encountered: