On Tue May 16 13:04:00 2023 +0000, David Kahurani wrote:
Yeah, I noticed that my changes alienate directories which should be part of the "dot files" but I think I have come across a different problem that might be harder to solve. The tests don't seem to like these changes....
GetTempPathA( MAX_PATH, temppath ); GetTempFileNameA( temppath, ".foo", 0, filename ); h = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0 ); ok( h != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); status = nt_get_file_attrs(filename, &attrs); ok( status == STATUS_SUCCESS, "got %#lx\n", status ); ok( !(attrs & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", attrs );
This test creates a temporary file(hidden as per its unix path but of course not hidden as per Windows functioning). The test expects that the file is not hidden but our changes make it so that the file is reported as hidden. I suspect the old code was carefully crafted so as to avoid marking a file as hidden unless it is absolutely necessary.
If I just do this, I don't seem to get any additional failures. We should add a test demonstrating the current problem though.
``` diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 0263d53716b..a740408fc58 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1305,8 +1305,7 @@ static BOOL is_hidden_file( const char *name ) while (p > name && p[-1] != '/') p--; if (*p++ != '.') return FALSE; if (!*p || *p == '/') return FALSE; /* "." directory */ - if (*p++ != '.') return FALSE; - if (!*p || *p == '/') return FALSE; /* ".." directory */ + if (*p++ == '.' && (!*p || *p == '/')) return FALSE; /* ".." directory */ return TRUE; } ```