macos-fuse-t / fuse-t

Other
808 stars 3 forks source link

xattr problem #57

Open rongliangtang opened 1 month ago

rongliangtang commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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