public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE
@ 2024-04-04 16:24 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2024-04-04 16:24 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=56e7563b9aa665f35b657537e46a7feb4726f763

commit 56e7563b9aa665f35b657537e46a7feb4726f763
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Thu Apr 4 17:36:01 2024 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Thu Apr 4 18:21:13 2024 +0200

    Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE
    
    If FILE_DIRECTORY_FILE is given, FILE_OPEN_NO_RECALL is not allowed,
    otherwise NtCreateFile returns STATUS_INVALID_PARAMETER.
    
    Drop FILE_OPEN_NO_RECALL where FILE_DIRECTORY_FILE is specified.
    
    Fixes: f6b56abec186 ("Cygwin: try to avoid recalling offline files")
    Reported-by: Bruce Jerrick <bmj001@gmail.com>
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler/disk_file.cc | 1 -
 winsup/cygwin/path.cc               | 2 --
 winsup/cygwin/release/3.5.4         | 6 ++++++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler/disk_file.cc b/winsup/cygwin/fhandler/disk_file.cc
index 865a05ad95a2..724ce7f7a587 100644
--- a/winsup/cygwin/fhandler/disk_file.cc
+++ b/winsup/cygwin/fhandler/disk_file.cc
@@ -325,7 +325,6 @@ fhandler_base::fstat_by_name (struct stat *buf)
       status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
 			   &attr, &io, FILE_SHARE_VALID_FLAGS,
 			   FILE_SYNCHRONOUS_IO_NONALERT
-			   | FILE_OPEN_NO_RECALL
 			   | FILE_OPEN_FOR_BACKUP_INTENT
 			   | FILE_DIRECTORY_FILE);
       if (!NT_SUCCESS (status))
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index fa5ceea1065a..5cfcbc0f2f6e 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -608,7 +608,6 @@ getfileattr (const char *path, bool caseinsensitive) /* path has to be always ab
       status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
 			   &attr, &io, FILE_SHARE_VALID_FLAGS,
 			   FILE_SYNCHRONOUS_IO_NONALERT
-			   | FILE_OPEN_NO_RECALL
 			   | FILE_OPEN_FOR_BACKUP_INTENT
 			   | FILE_DIRECTORY_FILE);
       if (NT_SUCCESS (status))
@@ -3340,7 +3339,6 @@ restart:
 	      status = NtOpenFile (&dir, SYNCHRONIZE | FILE_LIST_DIRECTORY,
 				   &dattr, &io, FILE_SHARE_VALID_FLAGS,
 				   FILE_SYNCHRONOUS_IO_NONALERT
-				   | FILE_OPEN_NO_RECALL
 				   | FILE_OPEN_FOR_BACKUP_INTENT
 				   | FILE_DIRECTORY_FILE);
 	      if (!NT_SUCCESS (status))
diff --git a/winsup/cygwin/release/3.5.4 b/winsup/cygwin/release/3.5.4
new file mode 100644
index 000000000000..e2bd025317e9
--- /dev/null
+++ b/winsup/cygwin/release/3.5.4
@@ -0,0 +1,6 @@
+Fixes:
+------
+
+- Fix regression in 3.5.3 which fails to open files for stat(2) if the
+  file is opened exclusively by another process.
+  Addresses: https://cygwin.com/pipermail/cygwin/2024-April/255811.html

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-04 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-04 16:24 [newlib-cygwin/main] Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).