Skip to content
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 problem #57

Open
rongliangtang opened this issue May 30, 2024 · 6 comments
Open

xattr problem #57

rongliangtang opened this issue May 30, 2024 · 6 comments

Comments

@rongliangtang
Copy link

Do fuset-t support xattr?
I found that xattr is problem.
For example, when I use cp command.
In the setxattr call, the pram size alway = 0.
and retuen "could not copy extended attributes"

@macos-fuse-t
Copy link
Owner

extended attributes are on by default. You can test it with fusexmp_fh in libfuse:

% touch 33                                                                                
% xattr -w ddd sss 33 
% cp 33 44
% xattr -l 44
ddd: sss

@rongliangtang
Copy link
Author

yes, in

extended attributes are on by default. You can test it with fusexmp_fh in libfuse:

% touch 33                                                                                
% xattr -w ddd sss 33 
% cp 33 44
% xattr -l 44
ddd: sss

yes , in fusexmp_fh ,it is fine.
But, in my application, is error.
Is fuse-t the same as fusexmp-fh?
I don't know why my application is error.

@rongliangtang
Copy link
Author

Hi, I try a simple demo in fuse-t, instead of fusexmp_fh in libfuse.
just run setxattr, I found size alway is 0.

#ifdef __APPLE__
static int xmp_setxattr(const char *path, const char *name, const char *value,
                        size_t size, int flags, uint32_t position)
#else
static int xmp_setxattr(const char *path, const char *name, const char *value,
			size_t size, int flags)
#endif
{
#ifdef __APPLE__
  int res;
  if (!strncmp(name, XATTR_APPLE_PREFIX, sizeof(XATTR_APPLE_PREFIX) - 1)) {
    flags &= ~(XATTR_NOSECURITY);
  }
  if (!strcmp(name, A_KAUTH_FILESEC_XATTR)) {
    char new_name[MAXPATHLEN];
    memcpy(new_name, A_KAUTH_FILESEC_XATTR, sizeof(A_KAUTH_FILESEC_XATTR));
    memcpy(new_name, G_PREFIX, sizeof(G_PREFIX) - 1);
    res = setxattr(path, new_name, value, size, position, flags);
  } else {
    res = setxattr(path, name, value, size, position, flags);
  }
#else
  int res = lsetxattr(path, name, value, size, flags);
#endif
  if (res == -1)
    return -errno;
  return 0;
}

@macos-fuse-t
Copy link
Owner

macos-fuse-t commented May 30, 2024

I don't understand what you're trying to say. fuse-t is the server code and libfuse is the client side.
In any case passing 0 as xattr size is valid and should create the attribute without a value.

@rongliangtang
Copy link
Author

I mean is it possible that the header file provided by fuse-t is inconsistent with the header file in libfuse?
Because I found that the example fusexmp_fh in libfuse is normal, while the demo I implemented based on fuse-t is not normal on setxattr.

@macos-fuse-t
Copy link
Owner

No, the headers are identical. Make sure you correctly implemented all xattr functions such as list, get and set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants