SingleFile bundles: Ensure extraction mappings are closed on Windows. (#2272)
authorSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>
Fri, 14 Feb 2020 23:38:20 +0000 (15:38 -0800)
committerGitHub <noreply@github.com>
Fri, 14 Feb 2020 23:38:20 +0000 (23:38 +0000)
commitb95e523a3003a5744506239ceaac2aafa3ac9a9d
tree415bfcafd516d9896e7338ee467a2ad2f3ef1d83
parent527adf211a45046876d680480e45131b5334fcf6
SingleFile bundles: Ensure extraction mappings are closed on Windows. (#2272)

When running a single-file app, the AppHost mmap()s itself in order
to read its contents and extract the embedded contents.

The Apphost must always map its contents in order to read the headers,
but doesn't always extract the contents, because previously extracted
files are re-used when available.

In the case where apphost doesn't extract, the file mapping wasn't
immediately closed on Windows. This prevents the app from being renamed
while running -- an idiom used while updating the app in-place.
src/installer/corehost/cli/apphost/bundle/runner.cpp
src/installer/corehost/cli/hostmisc/pal.unix.cpp
src/installer/corehost/cli/hostmisc/pal.windows.cpp
src/installer/test/Assets/TestProjects/AppWithWait/AppWithWait.csproj [new file with mode: 0644]
src/installer/test/Assets/TestProjects/AppWithWait/Program.cs [new file with mode: 0644]
src/installer/test/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundleRename.cs [new file with mode: 0644]
src/installer/test/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs
src/installer/test/TestUtils/TestProjectFixture.cs