public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/3] fix unlink/rename failure in hyper-v container
@ 2023-03-17 14:43 YO4
  2023-03-17 14:43 ` [PATCH 1/3] fix unlink in container YO4
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: YO4 @ 2023-03-17 14:43 UTC (permalink / raw)
  To: cygwin-patches; +Cc: YO4

Hello, cygwin developers.
I am using msys2 and it is based on the cygwin codebase.
I was working inside a windows container and encountered rm.exe and mv.exe failures.
I would be honored if you could merge my patch into upstream.

How to reproduce:
Use a version of windows that supports POSIX unlink/rename semantics as a container.
In a windows container using hyper-v isolation, rm.exe and mv.exe fail on bind mounted (also volume mounted) directories.

What this patch does
This patch will disable POSIX semantics and retry on the above failures.

The strace on failure is as follows
  806  192814 [main] rm 1473 _unlink_nt: Trying to delete \??\C:\binded_dir\file_to_unlink, isdir = 0
 1236  194050 [main] rm 1473 _unlink_nt: \??\C:\binded_dir\file_to_unlink, return status = 0xC000000D
  574  194624 [main] rm 1473 seterrno_from_nt_status: /c/S/msys2-runtime/src/msys2-runtime/winsup/cygwin/syscalls.cc:1120 status 0xC000000D -> windows error 87
  490  195114 [main] rm 1473 geterrno_from_win_error: windows error 87 == errno 22
  494  195608 [main] rm 1473 unlink: -1 = unlink(C:/binded_dir/file_to_unlink), errno 22

The strace with the patch is as follows
  737  234961 [main] rm 1822 _unlink_nt: Trying to delete \??\C:\binded_dir\file_to_unlink, isdir = 0
 1277  236238 [main] rm 1822 _unlink_nt: NtSetInformationFile (\??\C:\binded_dir\file_to_unlink, FileDispositionInformationEx) returns 0xC000000D with posix semantics. Disable it and retry.
 1411  237649 [main] rm 1822 _unlink_nt: \??\C:\binded_dir\file_to_unlink, return status = 0x0
  558  238207 [main] rm 1822 unlink: 0 = unlink(C:/binded_dir/file_to_unlink)

I ran the test in Appveyor so you can view the entire log at
https://ci.appveyor.com/project/YO4/test-msys2-in-container/builds/46532757/job/qinojh64uo6el78s
strace logs are available for download as artifacts.

This issue was first discussed here
https://github.com/msys2/msys2-runtime/issues/59
This patch is first available at 
https://github.com/msys2/msys2-runtime/pull/141


YO4 (3):
  fix unlink in container
  fix rename in container
  log disabling posix semantics

 winsup/cygwin/syscalls.cc | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

-- 
2.40.0.windows.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-03-24 14:20 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 14:43 [PATCH 0/3] fix unlink/rename failure in hyper-v container YO4
2023-03-17 14:43 ` [PATCH 1/3] fix unlink in container YO4
2023-03-17 14:43 ` [PATCH 2/3] fix rename " YO4
2023-03-17 14:43 ` [PATCH 3/3] log disabling posix semantics YO4
2023-03-17 19:15 ` [PATCH 0/3] fix unlink/rename failure in hyper-v container Corinna Vinschen
2023-03-18  5:29   ` Yoshinao Muramatsu
2023-03-18 10:01     ` Corinna Vinschen
2023-03-20 13:06       ` Yoshinao Muramatsu
2023-03-20 14:51         ` Corinna Vinschen
2023-03-20 14:54           ` Corinna Vinschen
2023-03-20 20:37           ` Corinna Vinschen
2023-03-21 15:32             ` Yoshinao Muramatsu
2023-03-21 17:58               ` Corinna Vinschen
2023-03-23 16:40                 ` Yoshinao Muramatsu
2023-03-24 11:54                   ` Corinna Vinschen
2023-03-24 13:20                     ` Jon Turney
2023-03-24 13:22                       ` Corinna Vinschen
2023-03-24 14:20                         ` Jon Turney
2023-03-24 13:48                     ` Yoshinao Muramatsu
2023-03-20 11:50   ` [PATCH 0/3] fix unlink/rename failure in hyper-v container(regenerate) Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 1/3] fix unlink in container Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 2/3] fix rename " Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 3/3] log disabling posix semantics Yoshinao Muramatsu
2023-03-20 12:12     ` [PATCH 0/3] fix unlink/rename failure in hyper-v container(regenerate) 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).