public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/cygwin-3_5-branch] Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE
Date: Thu,  4 Apr 2024 16:24:11 +0000 (GMT)	[thread overview]
Message-ID: <20240404162412.06B113858C98@sourceware.org> (raw)

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

commit e00cb126944e4d4e4b5ca4a2710a52ef6503462b
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:22:19 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 f3592148fc5b..2cfac6be1e57 100644
--- a/winsup/cygwin/fhandler/disk_file.cc
+++ b/winsup/cygwin/fhandler/disk_file.cc
@@ -330,7 +330,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 c0d62e5654b4..1802e76f71d8 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -576,7 +576,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))
@@ -3321,7 +3320,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

                 reply	other threads:[~2024-04-04 16:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240404162412.06B113858C98@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).