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

commit 258a81834bc349c3ac2ed77a4780e48d335d1dc4
Author:     Corinna Vinschen <cori...@vinschen.de>
AuthorDate: Thu Jan 23 23:38:43 2025 +0100
Commit:     Corinna Vinschen <cori...@vinschen.de>
CommitDate: Thu Jan 23 23:56:51 2025 +0100

    Cygwin: unlink_nt: clean up debug output and comment
    
    The debug statement supposed to be printed when deleting with POSIX
    semantics failed with STATUS_CANNOT_DELETE or STATUS_INVALID_PARAMETER
    is in the wrong spot.  While at it, simplify the related comment.
    
    Fixes: 9fa22dba558f ("Cygwin: unlink: allow fallback from POSIX to default 
method")
    Fixes: 527dd1b407e7 ("Cygwin: fix unlink in container")
    Fixes: 87ab6c7b26bf ("Cygwin: log disabling posix semantics")
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>
    (cherry picked from commit bf94b87f54de862a1c2482d411a18973b29264fe)

Diff:
---
 winsup/cygwin/syscalls.cc | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 290aa50ab647..7f7279ccb948 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -774,18 +774,15 @@ unlink_nt (path_conv &pc, bool shareable)
       if (access & FILE_WRITE_ATTRIBUTES)
        NtSetAttributesFile (fh, pc.file_attributes ());
       NtClose (fh);
-      /* Trying to delete in-use executables and DLLs using
-         FILE_DISPOSITION_POSIX_SEMANTICS returns STATUS_CANNOT_DELETE.
-        Fall back to the default method. */
-      /* Additionaly that returns STATUS_INVALID_PARAMETER
-         on a bind mounted fs in hyper-v container. Falling back too. */
-      if (status != STATUS_CANNOT_DELETE
-          && status != STATUS_INVALID_PARAMETER)
-        {
-          debug_printf ("NtSetInformationFile returns %y "
-                        "with posix semantics. Disable it and retry.", status);
-          goto out;
-        }
+      /* Trying POSIX delete on in-use executables and DLLs returns
+        STATUS_CANNOT_DELETE.  Trying POSIX delete on a bind mounted fs
+        in hyper-v container returns STATUS_INVALID_PARAMETER.
+         Fall back to default method in both cases. */
+      if (status != STATUS_CANNOT_DELETE && status != STATUS_INVALID_PARAMETER)
+       goto out;
+
+      debug_printf ("POSIX delete %S fails with %y, try default method",
+                   pc.get_nt_native_path (), status);
     }
 
   /* If the R/O attribute is set, we have to open the file with

Reply via email to