From e085dfda5d8dde064b0332464040959479696d1c Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 30 Sep 2023 12:49:18 +0200 Subject: patch 9.0.1962: No support for writing extended attributes Problem: No support for writing extended attributes Solution: Add extended attribute support for linux It's been a long standing issue, that if you write a file with extended attributes and backupcopy is set to no, the file will loose the extended attributes. So this patch adds support for retrieving the extended attributes and copying it to the new file. It currently only works on linux, mainly because I don't know the different APIs for other systems (BSD, MacOSX and Solaris). On linux, this should be supported since Kernel 2.4 or something, so this should be pretty safe to use now. Enable the extended attribute support with normal builds. I also added it explicitly to the :version output as well as make it able to check using `:echo has("xattr")`, to have users easily check that this is available. In contrast to the similar support for SELINUX and SMACK support (which also internally uses extended attributes), I have made this a FEAT_XATTR define, instead of the similar HAVE_XATTR. Add a test and change CI to include relevant packages so that CI can test that extended attributes are correctly written. closes: #306 closes: #13203 Signed-off-by: Christian Brabandt --- src/auto/configure | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/auto') diff --git a/src/auto/configure b/src/auto/configure index 34e9f449aa..54c1aa8159 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -825,6 +825,7 @@ with_global_runtime with_modified_by enable_smack enable_selinux +enable_xattr with_features with_compiledby enable_xsmp @@ -1514,6 +1515,7 @@ Optional Features: --disable-darwin Disable Darwin (Mac OS X) support. --disable-smack Do not check for Smack support. --disable-selinux Do not check for SELinux support. + --disable-xattr Do not check for XATTR support. --disable-xsmp Disable XSMP session management --disable-xsmp-interact Disable XSMP interaction --enable-luainterp=OPTS Include Lua interpreter. default=no OPTS=no/yes/dynamic @@ -5419,6 +5421,32 @@ printf "%s\n" "yes" >&6; } fi fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking --enable-xattr argument" >&5 +printf %s "checking --enable-xattr argument... " >&6; } +# Check whether --enable-xattr was given. +if test ${enable_xattr+y} +then : + enableval=$enable_xattr; +else $as_nop + enable_xattr="yes" +fi + +if test "$enable_xattr" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ac_fn_c_check_header_compile "$LINENO" "attr/xattr.h" "ac_cv_header_attr_xattr_h" "$ac_includes_default" +if test "x$ac_cv_header_attr_xattr_h" = xyes +then : + printf "%s\n" "#define HAVE_XATTR 1" >>confdefs.h + +fi + +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking --with-features argument" >&5 printf %s "checking --with-features argument... " >&6; } -- cgit v1.2.3