[PATCH v10 2/2] erofs-utils: fsck: introduce exporting xattrs
Gao Xiang
hsiangkao at linux.alibaba.com
Sat Sep 14 12:23:43 AEST 2024
On 2024/9/13 15:21, Hongzhen Luo wrote:
> Currently `fsck --extract` does not support exporting
> extended attributes. This patch adds the `--xattrs` option
> to dump extended attributes and the `--no-xattrs` option to
> omit them (the default behavior).
>
> Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
> ---
It fails to build on MacOS, I've applied the following fix manually:
diff --git a/configure.ac b/configure.ac
index 945e254..9c1657b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,6 +260,7 @@ AC_CHECK_FUNCS(m4_flatten([
gettimeofday
lgetxattr
llistxattr
+ lsetxattr
memset
realpath
lseek64
diff --git a/fsck/main.c b/fsck/main.c
index b514a63..f20b767 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -470,8 +470,15 @@ static int erofsfsck_dump_xattrs(struct erofs_inode *inode)
break;
}
if (fsckcfg.extract_path)
+#ifdef HAVE_LSETXATTR
ret = lsetxattr(fsckcfg.extract_path, key, value, size,
0);
+#elif defined(__APPLE__)
+ ret = setxattr(fsckcfg.extract_path, key, value, size,
+ 0, XATTR_NOFOLLOW);
+#else
+ ret = -EOPNOTSUPP;
+#endif
else
ret = 0;
free(value);
Thanks,
Gao Xiang
More information about the Linux-erofs
mailing list