Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some file operations fail in mounted folders of Hyper-v containers #338

Closed
YO4 opened this issue Mar 18, 2023 · 9 comments
Closed

Some file operations fail in mounted folders of Hyper-v containers #338

YO4 opened this issue Mar 18, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@YO4
Copy link

YO4 commented Mar 18, 2023

Describe the bug
When running in hyperv isolated windows container, delete/rename operations using posix semantics fail
with STATUS_INVALID_PARAMETER (0xC000000D) on the (bind | volume) mounted directory.

delete operation is NtSetInformationFile with FileDispositionInformationEx that has FILE_DISPOSITION_POSIX_SEMANTICS flag.
rename operation is NtSetInformationFile with FileRenameInformationEx that has FILE_RENAME_POSIX_SEMANTICS flag.

This failure occurs only mounted folder in hyperv container
but it's not be able to determine this in advance so you only know when it fails.

To Reproduce
Prepare windows container image that is msys2 installed.

docker run -it --rm --isolation=hyperv -v c:\some_folder:c:\target  msys2_image

In the container. use msys2's rm.exe / mv.exe

Microsoft Windows [Version 10.0.19041.264]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\>cd \target

C:\target>c:\msys64\msys2_shell.cmd -defterm -no-start -here

ContainerAdministrator@21f5fa9938da MSYS /c/target
# touch foo bar

ContainerAdministrator@21f5fa9938da MSYS /c/target
# rm foo
rm: cannot remove 'foo': Invalid argument

ContainerAdministrator@21f5fa9938da MSYS /c/target
# mv bar baz
mv: cannot move 'bar' to a subdirectory of itself, 'baz'

ContainerAdministrator@21f5fa9938da MSYS /c/target
# ls
bar  foo

Expected behavior
foo is deleted.
bar is renamed to baz.
so ls displays only baz.

Configuration:
The container base image seems to be applicable to any windows version that supports posix semantics delete/rename.
Container hosts are confirmed with Windows 10 Professional / Windows Server 2022.
for example

  • Edition: Windows Server [Version 10.0.20348.1547]
  • Base Image being used: mcr.microsoft.com/windows/servercore:ltsc2022 903e6f2eff2a

Additional context
You can see full test result in https://ci.appveyor.com/project/YO4/test-msys2-in-container/builds/46532757
For more details, see https://ci.appveyor.com/project/YO4/test-msys2-in-container/builds/46532757/job/qinojh64uo6el78s
and download trace log in artifacts.

Workaround patch for msys2 is here msys2/msys2-runtime#141
But it is desirable to eliminate the need for workaround.
Otherwise, I would like to know if it is possible to determine that posix semantics delete/rename cannot be used before failure.

@YO4 YO4 added the bug Something isn't working label Mar 18, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New and needs attention label Mar 18, 2023
@fady-azmy-msft fady-azmy-msft removed the triage New and needs attention label Mar 22, 2023
@fady-azmy-msft
Copy link
Contributor

Hey @YO4 , thank you for sharing this. I've opened an internal issue (#43876473) to look into this.

@ntrappe-msft
Copy link
Contributor

Hi! @YO4
Can you confirm that you're using Windows Server Core 2022 and Windows Server version 10.0.20348.1547? In the "To Reproduce" section it says Windows version 10.0.19041.264 in the code snapshot. I want to check because Windows version 10.0.19041.264 isn't compatible with Windows Server Core 2022.

@YO4
Copy link
Author

YO4 commented Apr 17, 2023

I found this problem with windows 10 professional and retested with windows server.
In previous reports I seem to have pasted it from the wrong place.
Again tested with mcr.microsoft.com/windows/servercore:ltsc2022 image just to be sure and confirmed that the situation occurs.

Microsoft Windows [Version 10.0.20348.1547]
(c) Microsoft Corporation. All rights reserved.

I have also confirmed that deletion and renaming succeeds when the --isolation=process option is used.

May be I should not have made this a separate issue, I am reporting the results of a more extensive test as #341.

@microsoft-github-policy-service
Copy link
Contributor

This issue has been open for 30 days with no updates.
no assignees, please provide an update or close this issue.

1 similar comment
@microsoft-github-policy-service
Copy link
Contributor

This issue has been open for 30 days with no updates.
no assignees, please provide an update or close this issue.

@ntrappe-msft
Copy link
Contributor

ntrappe-msft commented May 18, 2023

Still working on this, thanks for your patience. We were able to repro this and I do see the issue you encountered with msys2 not working for renaming and deleting files.

@microsoft-github-policy-service
Copy link
Contributor

This issue has been open for 30 days with no updates.
no assignees, please provide an update or close this issue.

1 similar comment
@microsoft-github-policy-service
Copy link
Contributor

This issue has been open for 30 days with no updates.
no assignees, please provide an update or close this issue.

@fady-azmy-msft
Copy link
Contributor

This issue has become stale, closing due to lack of activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants