Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>2020-05-01 19:24:13 +0300
committerGitHub <noreply@github.com>2020-05-01 19:24:13 +0300
commit47ec733ba79b196e4e09d0c89bad245155002353 (patch)
tree98fc7124abbcb678abe9687e757a77e638560f05 /src/installer/corehost/cli/hostmisc/pal.unix.cpp
parent6d1f7e01d3429054ec3dcb7c75b3450b9fe1429e (diff)
[release/5.0-preview4] Revert processing bundles in framework (#35679)v5.0.0-preview.4.20251.6
This commit reverts: Revert "Single-File: Process bundles in the framework (#34274)" This reverts commit 78b303df8fbb242985d049a277d0d199cafd51b5. Revert "Single-File Bundler: Add a FileSize test (#35149)" This reverts commit 779588a509b81d909ac5d496c172949ec1f1ddcc. *Customer Scenario* Publishing apps as a self-contained single-file doesn't work as expected. * Publish needs to generate hostpolicy and hostfxr separate from the single file bundle * Cross-platform publishing is incorrect *Problem* Since Static-apphost is not yet ready, processing bundle content in hostpolicy means that hostpolicy and hostfxr DLLs need to be separate from the bundle. This causes self-contained single-file apps to not be a "single file" temporarily. The change also requires supporting changes from the SDK, to publish hostfxr and hostpolicy as separate files, and to invoke HostModel library with arguments that facilitate cross-platform publishing. *Solution* To solve these, problem, this change reverts: Revert "Single-File: Process bundles in the framework (#34274)" commit 78b303df8fbb242985d049a277d0d199cafd51b5. and a dependent test-only change: Revert "Single-File Bundler: Add a FileSize test (#35149)" commit 779588a509b81d909ac5d496c172949ec1f1ddcc. *Risk* Medium The change is contained to only host components: apphost, hostpolicy, and hostfxr. However, the change is big, and needs testing in runtime and SDK repos. *Testing* Manually tested the SDK by inserting apphost, hostfxr, hostpolicy, and hostmodel library from this build into the `dotnet/packs` preview-4 SDK from https://github.com/dotnet/sdk/pull/11518 build. Verified that: * Singlefile apps can be published and run OK for { Windows, Linux, Osx } x {netcoreapp3.0, netcoreapp3.1, netcoreapp5.0} * Cross-targeting builds of single-file apps build and run OK (ex: built on Windos, run on Mac).
Diffstat (limited to 'src/installer/corehost/cli/hostmisc/pal.unix.cpp')
-rw-r--r--src/installer/corehost/cli/hostmisc/pal.unix.cpp30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/installer/corehost/cli/hostmisc/pal.unix.cpp b/src/installer/corehost/cli/hostmisc/pal.unix.cpp
index 3626761b0ec..2ca39c3793a 100644
--- a/src/installer/corehost/cli/hostmisc/pal.unix.cpp
+++ b/src/installer/corehost/cli/hostmisc/pal.unix.cpp
@@ -70,7 +70,7 @@ bool pal::touch_file(const pal::string_t& path)
return true;
}
-static void* map_file(const pal::string_t& path, size_t* length, int prot, int flags)
+void* pal::map_file_readonly(const pal::string_t& path, size_t& length)
{
int fd = open(path.c_str(), O_RDONLY);
if (fd == -1)
@@ -86,35 +86,21 @@ static void* map_file(const pal::string_t& path, size_t* length, int prot, int f
close(fd);
return nullptr;
}
- size_t size = buf.st_size;
- if (length != nullptr)
- {
- *length = size;
- }
-
- void* address = mmap(nullptr, size, prot, flags, fd, 0);
+ length = buf.st_size;
+ void* address = mmap(nullptr, length, PROT_READ, MAP_SHARED, fd, 0);
- if (address == MAP_FAILED)
+ if(address == nullptr)
{
trace::error(_X("Failed to map file. mmap(%s) failed with error %d"), path.c_str(), errno);
- address = nullptr;
+ close(fd);
+ return nullptr;
}
close(fd);
return address;
}
-const void* pal::mmap_read(const string_t& path, size_t* length)
-{
- return map_file(path, length, PROT_READ, MAP_SHARED);
-}
-
-void* pal::mmap_copy_on_write(const string_t& path, size_t* length)
-{
- return map_file(path, length, PROT_READ | PROT_WRITE, MAP_PRIVATE);
-}
-
bool pal::getcwd(pal::string_t* recv)
{
recv->clear();
@@ -504,10 +490,10 @@ bool pal::get_default_installation_dir(pal::string_t* recv)
pal::string_t trim_quotes(pal::string_t stringToCleanup)
{
pal::char_t quote_array[2] = {'\"', '\''};
- for (size_t index = 0; index < sizeof(quote_array)/sizeof(quote_array[0]); index++)
+ for(size_t index = 0; index < sizeof(quote_array)/sizeof(quote_array[0]); index++)
{
size_t pos = stringToCleanup.find(quote_array[index]);
- while (pos != std::string::npos)
+ while(pos != std::string::npos)
{
stringToCleanup = stringToCleanup.erase(pos, 1);
pos = stringToCleanup.find(quote_array[index]);