Patches from wine-staging
Fixes: #9158 Support for DOS hidden/system file attributes Fixes: #15679 cygwin symlinks not working in wine
From: "Erich E. Hoover" erich.e.hoover@gmail.com
--- configure.ac | 12 ++++++++++++ dlls/ntdll/unix/file.c | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 49d414e1d17..8b372f39dfa 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,7 @@ AC_ARG_WITH(unwind, AS_HELP_STRING([--without-unwind],[do not use the libunwi AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb library])) AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)])) AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan])) +AC_ARG_WITH(xattr, AS_HELP_STRING([--without-xattr],[do not use xattr (security attributes support)])) AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]), [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi]) AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]), @@ -635,6 +636,17 @@ AC_CHECK_HEADERS([libprocstat.h],,, #include <sys/queue.h> #endif])
+if test "x$with_xattr" != "xno" +then + AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1]) +fi +if test "x$with_xattr" = "xyes" +then + WINE_ERROR_WITH(xattr,[test "x$HAVE_XATTR" = "x"],[xattr ${notice_platform}development files \ +not found. Wine will be built without extended attribute support, which probably isn't what you \ +want. You will need to install ${notice_platform}development packages of libattr at the very least.]) +fi + dnl **** Check for working dll ****
AC_SUBST(DLLFLAGS,"") diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index b31ce4fbb3d..86f7542479f 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -98,6 +98,9 @@ #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif +#ifdef HAVE_ATTR_XATTR_H +#include <attr/xattr.h> +#endif #include <time.h> #include <unistd.h>
@@ -355,6 +358,20 @@ NTSTATUS errno_to_status( int err ) } }
+#ifndef XATTR_USER_PREFIX +#define XATTR_USER_PREFIX "user." +#endif + +static int xattr_get( const char *path, const char *name, void *value, size_t size ) +{ +#if defined(HAVE_ATTR_XATTR_H) + return getxattr( path, name, value, size ); +#else + errno = ENOSYS; + return -1; +#endif +} + /* get space from the current directory data buffer, allocating a new one if necessary */ static void *get_dir_data_space( struct dir_data *data, unsigned int size ) { @@ -1436,6 +1453,22 @@ static BOOL append_entry( struct dir_data *data, const char *long_name, }
+/* Match the Samba conventions for storing DOS file attributes */ +#define SAMBA_XATTR_DOS_ATTRIB XATTR_USER_PREFIX "DOSATTRIB" +/* We are only interested in some attributes, the others have corresponding Unix attributes */ +#define XATTR_ATTRIBS_MASK (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM) + +/* decode the xattr-stored DOS attributes */ +static inline int get_file_xattr( char *hexattr, int attrlen ) +{ + if (attrlen > 2 && hexattr[0] == '0' && hexattr[1] == 'x') + { + hexattr[attrlen] = 0; + return strtol( hexattr+2, NULL, 16 ) & XATTR_ATTRIBS_MASK; + } + return 0; +} + /* fetch the attributes of a file */ static inline ULONG get_file_attributes( const struct stat *st ) { @@ -1479,7 +1512,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON static int get_file_info( const char *path, struct stat *st, ULONG *attr ) { char *parent_path; - int ret; + char hexattr[11]; + int len, ret;
*attr = 0; ret = lstat( path, st ); @@ -1505,6 +1539,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) free( parent_path ); } *attr |= get_file_attributes( st ); + len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 ); + if (len == -1) return ret; + *attr |= get_file_xattr( hexattr, len ); return ret; }
From: "Erich E. Hoover" erich.e.hoover@gmail.com
--- dlls/ntdll/tests/file.c | 8 ++--- dlls/ntdll/unix/file.c | 74 ++++++++++++++++++++++++++++++----------- 2 files changed, 58 insertions(+), 24 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index dd0061b13d8..0e9352b9944 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -1392,7 +1392,7 @@ static void test_file_basic_information(void) memset(&fbi, 0, sizeof(fbi)); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation); ok ( res == STATUS_SUCCESS, "can't get attributes\n"); - todo_wine ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM\n", fbi.FileAttributes ); + ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr)\n", fbi.FileAttributes );
/* Then HIDDEN */ memset(&fbi, 0, sizeof(fbi)); @@ -1405,7 +1405,7 @@ static void test_file_basic_information(void) memset(&fbi, 0, sizeof(fbi)); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation); ok ( res == STATUS_SUCCESS, "can't get attributes\n"); - todo_wine ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN\n", fbi.FileAttributes ); + ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)\n", fbi.FileAttributes );
/* Check NORMAL last of all (to make sure we can clear attributes) */ memset(&fbi, 0, sizeof(fbi)); @@ -1462,7 +1462,7 @@ static void test_file_all_information(void) memset(&fai_buf.fai, 0, sizeof(fai_buf.fai)); res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); ok ( res == STATUS_SUCCESS, "can't get attributes, res %x\n", res); - todo_wine ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM\n", fai_buf.fai.BasicInformation.FileAttributes ); + ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr)\n", fai_buf.fai.BasicInformation.FileAttributes );
/* Then HIDDEN */ memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation)); @@ -1475,7 +1475,7 @@ static void test_file_all_information(void) memset(&fai_buf.fai, 0, sizeof(fai_buf.fai)); res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); ok ( res == STATUS_SUCCESS, "can't get attributes\n"); - todo_wine ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN\n", fai_buf.fai.BasicInformation.FileAttributes ); + ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)\n", fai_buf.fai.BasicInformation.FileAttributes );
/* Check NORMAL last of all (to make sure we can clear attributes) */ memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation)); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 86f7542479f..c9594510fb8 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -362,6 +362,26 @@ NTSTATUS errno_to_status( int err ) #define XATTR_USER_PREFIX "user." #endif
+static int xattr_fremove( int filedes, const char *name ) +{ +#if defined(HAVE_ATTR_XATTR_H) + return fremovexattr( filedes, name ); +#else + errno = ENOSYS; + return -1; +#endif +} + +static int xattr_fset( int filedes, const char *name, void *value, size_t size ) +{ +#if defined(HAVE_ATTR_XATTR_H) + return fsetxattr( filedes, name, value, size, 0 ); +#else + errno = ENOSYS; + return -1; +#endif +} + static int xattr_get( const char *path, const char *name, void *value, size_t size ) { #if defined(HAVE_ATTR_XATTR_H) @@ -1508,6 +1528,39 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON }
+/* set the stat info and file attributes for a file (by file descriptor) */ +NTSTATUS fd_set_file_info( int fd, ULONG attr ) +{ + char hexattr[11]; + struct stat st; + + if (fstat( fd, &st ) == -1) return errno_to_status( errno ); + if (attr & FILE_ATTRIBUTE_READONLY) + { + if (S_ISDIR( st.st_mode)) + WARN("FILE_ATTRIBUTE_READONLY ignored for directory.\n"); + else + st.st_mode &= ~0222; /* clear write permission bits */ + } + else + { + /* add write permission only where we already have read permission */ + st.st_mode |= (0600 | ((st.st_mode & 044) >> 1)) & (~start_umask); + } + if (fchmod( fd, st.st_mode ) == -1) return errno_to_status( errno ); + attr &= ~FILE_ATTRIBUTE_NORMAL; /* do not store everything, but keep everything Samba can use */ + if (attr != 0) + { + int len; + + len = sprintf( hexattr, "0x%x", attr ); + xattr_fset( fd, SAMBA_XATTR_DOS_ATTRIB, hexattr, len ); + } + else + xattr_fremove( fd, SAMBA_XATTR_DOS_ATTRIB ); + return STATUS_SUCCESS; +} + /* get the stat info and file attributes for a file (by name) */ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) { @@ -4400,7 +4453,6 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, case FileBasicInformation: if (len >= sizeof(FILE_BASIC_INFORMATION)) { - struct stat st; const FILE_BASIC_INFORMATION *info = ptr; LARGE_INTEGER mtime, atime;
@@ -4414,25 +4466,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, status = set_file_times( fd, &mtime, &atime );
if (status == STATUS_SUCCESS && info->FileAttributes) - { - if (fstat( fd, &st ) == -1) status = errno_to_status( errno ); - else - { - if (info->FileAttributes & FILE_ATTRIBUTE_READONLY) - { - if (S_ISDIR( st.st_mode)) - WARN("FILE_ATTRIBUTE_READONLY ignored for directory.\n"); - else - st.st_mode &= ~0222; /* clear write permission bits */ - } - else - { - /* add write permission only where we already have read permission */ - st.st_mode |= (0600 | ((st.st_mode & 044) >> 1)) & (~start_umask); - } - if (fchmod( fd, st.st_mode ) == -1) status = errno_to_status( errno ); - } - } + status = fd_set_file_info( fd, info->FileAttributes );
if (needs_close) close( fd ); }
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=123069
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Arabic:Morocco report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit German report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit French report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Hebrew:Israel report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Hindi:India report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Japanese:Japan report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Chinese:China report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit WoW report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (64 bit WoW report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
From: "Erich E. Hoover" erich.e.hoover@gmail.com
--- dlls/ntdll/tests/directory.c | 24 ++++++++--------- dlls/ntdll/unix/file.c | 51 ++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index 2a5fedb4659..dda2afe3703 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -55,7 +55,6 @@ static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG *
/* The attribute sets to test */ static struct testfile_s { - BOOL todo; /* set if it doesn't work on wine yet */ BOOL attr_done; /* set if attributes were tested for this file already */ const DWORD attr; /* desired attribute */ WCHAR name[20]; /* filename to use */ @@ -63,16 +62,16 @@ static struct testfile_s { const char *description; /* for error messages */ int nfound; /* How many were found (expect 1) */ } testfiles[] = { - { 0, 0, FILE_ATTRIBUTE_NORMAL, {'l','o','n','g','f','i','l','e','n','a','m','e','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {'n','.','t','m','p',}, "normal" }, - { 1, 0, FILE_ATTRIBUTE_HIDDEN, {'h','.','t','m','p',}, "hidden" }, - { 1, 0, FILE_ATTRIBUTE_SYSTEM, {'s','.','t','m','p',}, "system" }, - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'d','.','t','m','p',}, "directory" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {0xe9,'a','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {0xc9,'b','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {'e','a','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'.'}, ". directory" }, - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" } + { 0, FILE_ATTRIBUTE_NORMAL, {'l','o','n','g','f','i','l','e','n','a','m','e','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'n','.','t','m','p',}, "normal" }, + { 0, FILE_ATTRIBUTE_HIDDEN, {'h','.','t','m','p',}, "hidden" }, + { 0, FILE_ATTRIBUTE_SYSTEM, {'s','.','t','m','p',}, "system" }, + { 0, FILE_ATTRIBUTE_DIRECTORY, {'d','.','t','m','p',}, "directory" }, + { 0, FILE_ATTRIBUTE_NORMAL, {0xe9,'a','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {0xc9,'b','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'e','a','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_DIRECTORY, {'.'}, ". directory" }, + { 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" } }; static const int test_dir_count = ARRAY_SIZE(testfiles); static const int max_test_dir_size = ARRAY_SIZE(testfiles) + 5; /* size of above plus some for .. etc */ @@ -162,8 +161,7 @@ static void tally_test_file(FILE_BOTH_DIRECTORY_INFORMATION *dir_info) if (namelen != len || memcmp(nameW, testfiles[i].name, len*sizeof(WCHAR))) continue; if (!testfiles[i].attr_done) { - todo_wine_if (testfiles[i].todo) - ok (attrib == (testfiles[i].attr & attribmask), "file %s: expected %s (%lx), got %lx (is your linux new enough?)\n", wine_dbgstr_w(testfiles[i].name), testfiles[i].description, testfiles[i].attr, attrib); + ok (attrib == (testfiles[i].attr & attribmask), "file %s: expected %s (%lx), got %lx (is your linux new enough?)\n", wine_dbgstr_w(testfiles[i].name), testfiles[i].description, testfiles[i].attr, attrib); testfiles[i].attr_done = TRUE; } testfiles[i].nfound++; diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index c9594510fb8..094c5eb5ab5 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -392,6 +392,26 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si #endif }
+static int xattr_remove( const char *path, const char *name ) +{ +#if defined(HAVE_ATTR_XATTR_H) + return removexattr( path, name ); +#else + errno = ENOSYS; + return -1; +#endif +} + +static int xattr_set( const char *path, const char *name, void *value, size_t size ) +{ +#if defined(HAVE_ATTR_XATTR_H) + return setxattr( path, name, value, size, 0 ); +#else + errno = ENOSYS; + return -1; +#endif +} + /* get space from the current directory data buffer, allocating a new one if necessary */ static void *get_dir_data_space( struct dir_data *data, unsigned int size ) { @@ -3827,6 +3847,20 @@ static NTSTATUS unmount_device( HANDLE handle ) return status; }
+NTSTATUS set_file_info( const char *path, ULONG attr ) +{ + char hexattr[11]; + int len; + + /* Note: unix mode already set when called this way */ + attr &= ~FILE_ATTRIBUTE_NORMAL; /* do not store everything, but keep everything Samba can use */ + len = sprintf( hexattr, "0x%x", attr ); + if (attr != 0) + xattr_set( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, len ); + else + xattr_remove( path, SAMBA_XATTR_DOS_ATTRIB ); + return STATUS_SUCCESS; +}
/****************************************************************************** * open_unix_file @@ -3912,13 +3946,14 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU status = STATUS_SUCCESS; }
- if (status == STATUS_SUCCESS) + if (status != STATUS_SUCCESS) { - status = open_unix_file( handle, unix_name, access, &new_attr, attributes, - sharing, disposition, options, ea_buffer, ea_length ); - free( unix_name ); + WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status ); + return status; } - else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status ); + + status = open_unix_file( handle, unix_name, access, &new_attr, attributes, + sharing, disposition, options, ea_buffer, ea_length );
if (status == STATUS_SUCCESS) { @@ -3940,6 +3975,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU io->Information = FILE_OVERWRITTEN; break; } + if (io->Information == FILE_CREATED) + { + /* set any DOS extended attributes */ + set_file_info( unix_name, attributes ); + } } else if (status == STATUS_TOO_MANY_OPENED_FILES) { @@ -3948,6 +3988,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU }
free( nt_name.Buffer ); + free( unix_name ); return io->u.Status = status; }
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=123070
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Arabic:Morocco report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?)
=== debian11 (32 bit German report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?)
=== debian11 (32 bit French report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?)
=== debian11 (32 bit Hebrew:Israel report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?)
=== debian11 (32 bit Hindi:India report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?)
=== debian11 (32 bit Japanese:Japan report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?)
=== debian11 (32 bit Chinese:China report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit WoW report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (64 bit WoW report) ===
ntdll: directory.c:164: Test failed: file L"h.tmp": expected (null) (2), got 0 (is your linux new enough?) directory.c:164: Test failed: file L"s.tmp": expected (null) (4), got 0 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
From: "Erich E. Hoover" erich.e.hoover@gmail.com
--- configure.ac | 3 +++ dlls/ntdll/unix/file.c | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac index 8b372f39dfa..d7803b875f2 100644 --- a/configure.ac +++ b/configure.ac @@ -639,6 +639,9 @@ AC_CHECK_HEADERS([libprocstat.h],,, if test "x$with_xattr" != "xno" then AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1]) + AC_CHECK_HEADERS(sys/xattr.h, [HAVE_XATTR=1] + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]], [[getxattr("", "", "", 0, 0, 0);]])], + [AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr functions take additional arguments (Mac OS X)])])]) fi if test "x$with_xattr" = "xyes" then diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 094c5eb5ab5..1090b5fd563 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -99,7 +99,10 @@ #include <sys/statfs.h> #endif #ifdef HAVE_ATTR_XATTR_H +#undef XATTR_ADDITIONAL_OPTIONS #include <attr/xattr.h> +#elif defined(HAVE_SYS_XATTR_H) +#include <sys/xattr.h> #endif #include <time.h> #include <unistd.h> @@ -364,7 +367,9 @@ NTSTATUS errno_to_status( int err )
static int xattr_fremove( int filedes, const char *name ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return fremovexattr( filedes, name, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return fremovexattr( filedes, name ); #else errno = ENOSYS; @@ -374,7 +379,9 @@ static int xattr_fremove( int filedes, const char *name )
static int xattr_fset( int filedes, const char *name, void *value, size_t size ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return fsetxattr( filedes, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return fsetxattr( filedes, name, value, size, 0 ); #else errno = ENOSYS; @@ -384,7 +391,9 @@ static int xattr_fset( int filedes, const char *name, void *value, size_t size )
static int xattr_get( const char *path, const char *name, void *value, size_t size ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return getxattr( path, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return getxattr( path, name, value, size ); #else errno = ENOSYS; @@ -394,7 +403,9 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
static int xattr_remove( const char *path, const char *name ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return removexattr( path, name, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return removexattr( path, name ); #else errno = ENOSYS; @@ -404,7 +415,9 @@ static int xattr_remove( const char *path, const char *name )
static int xattr_set( const char *path, const char *name, void *value, size_t size ) { -#if defined(HAVE_ATTR_XATTR_H) +#if defined(XATTR_ADDITIONAL_OPTIONS) + return setxattr( path, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return setxattr( path, name, value, size, 0 ); #else errno = ENOSYS;
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=123071
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Chinese:China report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit WoW report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (64 bit WoW report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
From: "Erich E. Hoover" erich.e.hoover@gmail.com
--- configure.ac | 2 +- dlls/ntdll/unix/file.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index d7803b875f2..3ea4c2afe0a 100644 --- a/configure.ac +++ b/configure.ac @@ -638,7 +638,7 @@ AC_CHECK_HEADERS([libprocstat.h],,,
if test "x$with_xattr" != "xno" then - AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1]) + AC_CHECK_HEADERS(attr/xattr.h sys/extattr.h, [HAVE_XATTR=1]) AC_CHECK_HEADERS(sys/xattr.h, [HAVE_XATTR=1] [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]], [[getxattr("", "", "", 0, 0, 0);]])], [AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr functions take additional arguments (Mac OS X)])])]) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 1090b5fd563..d85c69cb1bc 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -104,6 +104,10 @@ #elif defined(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>
@@ -364,6 +368,21 @@ NTSTATUS errno_to_status( int err ) #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 + +#ifdef HAVE_SYS_EXTATTR_H +static inline int xattr_valid_namespace( const char *name ) +{ + if (strncmp( XATTR_USER_PREFIX, name, XATTR_USER_PREFIX_LEN ) != 0) + { + errno = EPERM; + return 0; + } + return 1; +} +#endif
static int xattr_fremove( int filedes, const char *name ) { @@ -371,6 +390,9 @@ static int xattr_fremove( int filedes, const char *name ) return fremovexattr( filedes, name, 0 ); #elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return fremovexattr( filedes, name ); +#elif defined(HAVE_SYS_EXTATTR_H) + if (!xattr_valid_namespace( name )) return -1; + return extattr_delete_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] ); #else errno = ENOSYS; return -1; @@ -383,6 +405,10 @@ static int xattr_fset( int filedes, const char *name, void *value, size_t size ) return fsetxattr( filedes, name, value, size, 0, 0 ); #elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return fsetxattr( filedes, name, value, size, 0 ); +#elif defined(HAVE_SYS_EXTATTR_H) + if (!xattr_valid_namespace( name )) return -1; + return extattr_set_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; @@ -395,6 +421,10 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si return getxattr( path, name, value, size, 0, 0 ); #elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return getxattr( path, name, value, size ); +#elif defined(HAVE_SYS_EXTATTR_H) + if (!xattr_valid_namespace( name )) return -1; + return extattr_get_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1; @@ -407,6 +437,9 @@ static int xattr_remove( const char *path, const char *name ) return removexattr( path, name, 0 ); #elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return removexattr( path, name ); +#elif defined(HAVE_SYS_EXTATTR_H) + if (!xattr_valid_namespace( name )) return -1; + return extattr_delete_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN] ); #else errno = ENOSYS; return -1; @@ -419,6 +452,10 @@ static int xattr_set( const char *path, const char *name, void *value, size_t si return setxattr( path, name, value, size, 0, 0 ); #elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) return setxattr( path, name, value, size, 0 ); +#elif defined(HAVE_SYS_EXTATTR_H) + if (!xattr_valid_namespace( name )) return -1; + return extattr_set_file( path, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); #else errno = ENOSYS; return -1;
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=123072
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Chinese:China report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit WoW report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (64 bit WoW report) ===
ntdll: file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
From: "Erich E. Hoover" erich.e.hoover@gmail.com
--- dlls/ntdll/unix/file.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index d85c69cb1bc..c87884205dd 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1311,15 +1311,15 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir ) * * Check if the specified file should be hidden based on its name and the show dot files option. */ -static BOOL is_hidden_file( const UNICODE_STRING *name ) +static BOOL is_hidden_file( const char *name ) { - WCHAR *p, *end; + const char *p, *end;
if (show_dot_files) return FALSE;
- end = p = name->Buffer + name->Length/sizeof(WCHAR); - while (p > name->Buffer && p[-1] == '\') p--; - while (p > name->Buffer && p[-1] != '\') p--; + end = p = name + strlen( name ); + while (p > name && p[-1] == '\') p--; + while (p > name && p[-1] != '\') p--; return (p < end && *p == '.'); }
@@ -1662,6 +1662,10 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) free( parent_path ); } *attr |= get_file_attributes( st ); + /* convert Unix-style hidden files to a DOS hidden file attribute */ + if (is_hidden_file( path )) + *attr |= FILE_ATTRIBUTE_HIDDEN; + /* retrieve any stored DOS attributes */ len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 ); if (len == -1) return ret; *attr |= get_file_xattr( hexattr, len ); @@ -2228,11 +2232,6 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I if (class != FileNamesInformation) { if (st.st_dev != dir_data->id.dev) st.st_ino = 0; /* ignore inode if on a different device */ - - if (!show_dot_files && names->long_name[0] == '.' && names->long_name[1] && - (names->long_name[1] != '.' || names->long_name[2])) - attributes |= FILE_ATTRIBUTE_HIDDEN; - fill_file_info( &st, attributes, info, class ); }
@@ -4196,7 +4195,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr, info->AllocationSize = std.AllocationSize; info->EndOfFile = std.EndOfFile; info->FileAttributes = basic.FileAttributes; - if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN; } free( unix_name ); } @@ -4227,10 +4225,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) status = STATUS_INVALID_INFO_CLASS; else - { status = fill_file_info( &st, attributes, info, FileBasicInformation ); - if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN; - } free( unix_name ); } else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
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=123073
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Chinese:China report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit WoW report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (64 bit WoW report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
From: Sebastian Lackner sebastian@fds-team.de
--- dlls/ntdll/unix/file.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index c87884205dd..2386829f3c8 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1662,12 +1662,15 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) free( parent_path ); } *attr |= get_file_attributes( st ); - /* convert Unix-style hidden files to a DOS hidden file attribute */ - if (is_hidden_file( path )) - *attr |= FILE_ATTRIBUTE_HIDDEN; /* retrieve any stored DOS attributes */ len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 ); - if (len == -1) return ret; + if (len == -1) + { + /* convert Unix-style hidden files to a DOS hidden file attribute */ + if (is_hidden_file( path )) + *attr |= FILE_ATTRIBUTE_HIDDEN; + return ret; + } *attr |= get_file_xattr( hexattr, len ); return ret; } @@ -3904,7 +3907,7 @@ NTSTATUS set_file_info( const char *path, ULONG attr ) /* Note: unix mode already set when called this way */ attr &= ~FILE_ATTRIBUTE_NORMAL; /* do not store everything, but keep everything Samba can use */ len = sprintf( hexattr, "0x%x", attr ); - if (attr != 0) + if (attr != 0 || is_hidden_file( path )) xattr_set( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, len ); else xattr_remove( path, SAMBA_XATTR_DOS_ATTRIB );
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=123074
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit Chinese:China report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (32 bit WoW report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
=== debian11 (64 bit WoW report) ===
ntdll: directory.c:164: Test failed: file L".": expected (null) (10), got 12 (is your linux new enough?) directory.c:164: Test failed: file L"..": expected (null) (10), got 12 (is your linux new enough?) file.c:1395: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1408: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr) file.c:1465: Test failed: attribute 20 not FILE_ATTRIBUTE_SYSTEM (ok in old linux without xattr) file.c:1478: Test failed: attribute 20 not FILE_ATTRIBUTE_HIDDEN (ok in old linux without xattr)
Since these aren't your patches, you will need to add a signoff on all the patches.
Since these aren't your patches, you will need to add a signoff on all the patches.
Ok - will do.
Just to state my agenda. I am working on fixing issues that are preventing Msys2 from working properly on Wine. Many of the problems have been partially addressed previously, and there's a lot of half finished work hanging around in staging, and patches in the bug tracker. I am attempting to collect all these pieces of work together, and figure out what needs to be done to get the patches included in the mainline.
It may well be the case that these patches have been reviewed long ago and were rejected. Hopefully these merge requests are a good opportunity to revisit these things and bring them to a conclusion.
This merge request was closed by Joel Holdsworth.
Since these aren't your patches, you will need to add a signoff on all the patches.
Actually you don't. With the new workflow, all you need is to approve the MR in Gitlab.
Actually you don't. With the new workflow, all you need is to approve the MR in Gitlab.
I closed the MR for now. I wasn't expecting to see test failures, and even if I don't *need* to tag all the patches with a signoff, I do need to go back and make sure I am happy to sign off on each of them. This would include testing the relevant patches on FreeBSD and MacOS.
Also, I think the last two patches - using the UNIX-style `.XXX` file name prefix to denote a DOS hidden file, is a rather dubious concept, so I plan to drop these patches from the collection. Personally, I think that if we accept the concept of using `xattr` for this metadata, then DOS hidden files would be better handled with an attribute, than trying to bridge between UNIX-style hidden files and DOS-style hidden files.
@julliard do you have any comments? is there anything else you would like to see addressed here?