Co-authored-by: Joel Holdsworth joel@airwebreathe.org.uk Signed-off-by: Joel Holdsworth joel@airwebreathe.org.uk
-- v2: ntdll: Add support for FreeBSD style extended attributes.
From: "Erich E. Hoover" erich.e.hoover@gmail.com
Co-authored-by: Joel Holdsworth joel@airwebreathe.org.uk Signed-off-by: Joel Holdsworth joel@airwebreathe.org.uk --- configure | 6 ++++++ configure.ac | 1 + dlls/ntdll/unix/file.c | 32 +++++++++++++++++++++++++++----- include/config.h.in | 3 +++ 4 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/configure b/configure index 76ac7311e6d..cf1aee5690b 100755 --- a/configure +++ b/configure @@ -8211,6 +8211,12 @@ if test "x$ac_cv_header_sys_event_h" = xyes then : printf "%s\n" "#define HAVE_SYS_EVENT_H 1" >>confdefs.h
+fi +ac_fn_c_check_header_compile "$LINENO" "sys/extattr.h" "ac_cv_header_sys_extattr_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_extattr_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_EXTATTR_H 1" >>confdefs.h + fi ac_fn_c_check_header_compile "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" if test "x$ac_cv_header_sys_filio_h" = xyes diff --git a/configure.ac b/configure.ac index 423f883b6a8..ac398060b54 100644 --- a/configure.ac +++ b/configure.ac @@ -470,6 +470,7 @@ AC_CHECK_HEADERS(\ sys/cdio.h \ sys/epoll.h \ sys/event.h \ + sys/extattr.h \ sys/filio.h \ sys/ipc.h \ sys/link.h \ diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 6b73d9dc7e8..012db91c171 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -102,6 +102,10 @@ #ifdef HAVE_SYS_XATTR_H #include <sys/xattr.h> #endif +#ifdef HAVE_SYS_EXTATTR_H +#undef XATTR_ADDITIONAL_OPTIONS +#include <sys/extattr.h> +#endif #include <time.h> #include <unistd.h>
@@ -171,7 +175,14 @@ typedef struct
#define MAX_IGNORED_FILES 4
-#define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" +#ifndef XATTR_USER_PREFIX +# define XATTR_USER_PREFIX "user." +#endif +#ifndef XATTR_USER_PREFIX_LEN +# define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1) +#endif + +#define SAMBA_XATTR_DOS_ATTRIB XATTR_USER_PREFIX "DOSATTRIB" #define XATTR_ATTRIBS_MASK (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)
struct file_identity @@ -365,12 +376,14 @@ NTSTATUS errno_to_status( int err )
static int xattr_fremove( int filedes, const char *name ) { -#ifdef HAVE_SYS_XATTR_H +#if defined(HAVE_SYS_XATTR_H) # ifdef XATTR_ADDITIONAL_OPTIONS return fremovexattr( filedes, name, 0 ); # else return fremovexattr( filedes, name ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_delete_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] ); #else errno = ENOSYS; return -1; @@ -380,12 +393,15 @@ static int xattr_fremove( int filedes, const char *name )
static int xattr_fset( int filedes, const char *name, const void *value, size_t size ) { -#ifdef HAVE_SYS_XATTR_H +#if defined(HAVE_SYS_XATTR_H) # ifdef XATTR_ADDITIONAL_OPTIONS return fsetxattr( filedes, name, value, size, 0, 0 ); # else return fsetxattr( filedes, name, value, size, 0 ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_set_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; @@ -395,12 +411,15 @@ static int xattr_fset( int filedes, const char *name, const void *value, size_t
static int xattr_get( const char *path, const char *name, void *value, size_t size ) { -#ifdef HAVE_SYS_XATTR_H +#if defined(HAVE_SYS_XATTR_H) # ifdef XATTR_ADDITIONAL_OPTIONS return getxattr( path, name, value, size, 0, 0 ); # else return getxattr( path, name, value, size ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_get_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; @@ -410,12 +429,15 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
static int xattr_fget( int filedes, const char *name, void *value, size_t size ) { -#ifdef HAVE_SYS_XATTR_H +#if defined(HAVE_SYS_XATTR_H) # ifdef XATTR_ADDITIONAL_OPTIONS return fgetxattr( filedes, name, value, size, 0, 0 ); # else return fgetxattr( filedes, name, value, size ); # endif +#elif defined(HAVE_SYS_EXTATTR_H) + return extattr_get_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; diff --git a/include/config.h.in b/include/config.h.in index 694b11cf8c2..b21a7be6e06 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -574,6 +574,9 @@ /* Define to 1 if you have the <sys/event.h> header file. */ #undef HAVE_SYS_EVENT_H
+/* Define to 1 if you have the <sys/extattr.h> header file. */ +#undef HAVE_SYS_EXTATTR_H + /* Define to 1 if you have the <sys/filio.h> header file. */ #undef HAVE_SYS_FILIO_H
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126118
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: advapi32:security has no test summary line (early exit of the main process?) advapi32:security has unaccounted for todo messages
On Sun Nov 13 18:01:37 2022 +0000, Zebediah Figura wrote:
Makes sense. I didn't actually check that it's identical to the wine-staging version (or that we haven't broken the latter in the years it's been there), but it seems likely enough that it still works correctly :-)
I just retested it on FreeBSD. It compiles fine.
However, the FreeBSD build is currently broken due to this bug: https://bugs.winehq.org/show_bug.cgi?id=53916 .
I wonder if there is any chance of a FreeBSD CI machine. It's a bit nerve-wracking making changes to Wine's UNIX code, because there's always a chance that my patch might break on FreeBSD, or for that matter NetBSD, Solaris, or any other *Nix that Wine claims to support.