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

[mono][aot] macOS: Permission issues with workloads #53545

Closed
radical opened this issue Jun 1, 2021 · 4 comments
Closed

[mono][aot] macOS: Permission issues with workloads #53545

radical opened this issue Jun 1, 2021 · 4 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-Build-mono os-android os-ios Apple iOS
Milestone

Comments

@radical
Copy link
Member

radical commented Jun 1, 2021

Based off #53314 .

Steps to reproduce:

  1. install dotnet preview 4 (https://dotnet.microsoft.com/download/dotnet/6.0), into a system location
  2. install the workload packs with: dotnet workload install microsoft-net-sdk-blazorwebassembly-aot. You would need to run that as root
  3. create a new blazor project with dotnet new blazorwasm
  4. Add <RunAOTCompilation>true</RunAOTCompilation>, and <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="6.0.0-preview.4.21253.5" /> to the project
  5. build with dotnet publish -c:release -p:RunAOTCompilation=true -bl

Fails with:

                     System.ComponentModel.Win32Exception (13): Permission denied
                        at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UIn
                        at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) in System.Diagnostics.Process.dll:token 0x6000105+0x1aa
                        at System.Diagnostics.Process.Start() in System.Diagnostics.Process.dll:token 0x60000de+0xab
                        at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) in System.Diagnostics.Process.dll:token 0x60000e2+0x1b
                        at Utils.RunProcess(String path, String args, IDictionary`2 envVars, String workingDir, Boolean ignoreErrors, Boolean silent, MessageImportance outputMessageImportance, MessageImportance debugMessageImporta
                        at MonoAOTCompiler.PrecompileLibrary(ITaskItem assemblyItem, String monoPaths) in MonoAOTCompiler.dll:token 0x600002b+0x436 (TaskId:149)

-rwxr--r-- 1 root wheel 12062648 May 3 14:42 /usr/local/share/dotnet/packs/microsoft.netcore.app.runtime.aot.osx-x64.cross.browser-wasm/6.0.0-preview.4.21253.7/Sdk/../tools/mono-aot-cross*

Problem 1. mono-aot-cross has execute permission only for the owner(root).

fixing the permission for that, and building again fails with:

/var/folders/7c/zpmy8k_d4d1grky_s154kk640000gp/T/tmp6376bf6641524777815553f841d39a51.exec.cmd: line 2: /usr/local/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.osx-x64/6.0.0-preview.4.21220.1/tools/emscripten/emcc: Permission denied

-rwxr--r-- 1 root wheel 716 Sep 23 2020 /usr/local/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.osx-x64/6.0.0-preview.4.21220.1/tools/emscripten/emcc*

Problem 2: emcc (and possibly other emscripten files) don't have the right permissions

cc @lewing @akoeplinger @steveisok

@radical radical added the arch-wasm WebAssembly architecture label Jun 1, 2021
@ghost
Copy link

ghost commented Jun 1, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Steps to reproduce:

  1. install dotnet preview 4 (https://dotnet.microsoft.com/download/dotnet/6.0), into a system location
  2. install the workload packs with: dotnet workload install microsoft-net-sdk-blazorwebassembly-aot. You would need to run that as root
  3. create a new blazor project with dotnet new blazorwasm
  4. Add <RunAOTCompilation>true</RunAOTcompilation>, and <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="6.0.0-preview.4.21253.5" /> to the project
  5. build with dotnet publish -c:release -p:RunAOTCompilation=true -bl

Fails with:

                     System.ComponentModel.Win32Exception (13): Permission denied
                        at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UIn
                        at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) in System.Diagnostics.Process.dll:token 0x6000105+0x1aa
                        at System.Diagnostics.Process.Start() in System.Diagnostics.Process.dll:token 0x60000de+0xab
                        at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) in System.Diagnostics.Process.dll:token 0x60000e2+0x1b
                        at Utils.RunProcess(String path, String args, IDictionary`2 envVars, String workingDir, Boolean ignoreErrors, Boolean silent, MessageImportance outputMessageImportance, MessageImportance debugMessageImporta
                        at MonoAOTCompiler.PrecompileLibrary(ITaskItem assemblyItem, String monoPaths) in MonoAOTCompiler.dll:token 0x600002b+0x436 (TaskId:149)

-rwxr--r-- 1 root wheel 12062648 May 3 14:42 /usr/local/share/dotnet/packs/microsoft.netcore.app.runtime.aot.osx-x64.cross.browser-wasm/6.0.0-preview.4.21253.7/Sdk/../tools/mono-aot-cross*

Problem 1. mono-aot-cross has execute permission only for the owner(root).

fixing the permission for that, and building again fails with:

/var/folders/7c/zpmy8k_d4d1grky_s154kk640000gp/T/tmp6376bf6641524777815553f841d39a51.exec.cmd: line 2: /usr/local/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.osx-x64/6.0.0-preview.4.21220.1/tools/emscripten/emcc: Permission denied

-rwxr--r-- 1 root wheel 716 Sep 23 2020 /usr/local/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.osx-x64/6.0.0-preview.4.21220.1/tools/emscripten/emcc*

Problem 2: emcc (and possibly other emscripten files) don't have the right permissions

cc @lewing @akoeplinger @steveisok

Author: radical
Assignees: -
Labels:

arch-wasm

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Diagnostics.Process untriaged New issue has not been triaged by the area owner labels Jun 1, 2021
@lewing lewing added this to the 5.0.x milestone Jun 1, 2021
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Jun 1, 2021
@marek-safar marek-safar modified the milestones: 5.0.x, 6.0.0 Jun 2, 2021
@lewing lewing changed the title [wasm][aot] macOS: Permission issues with workloads [mono][aot] macOS: Permission issues with workloads Jun 17, 2021
@lewing
Copy link
Member

lewing commented Jun 17, 2021

cc @steveisok

@akoeplinger
Copy link
Member

This should probably help: dotnet/sdk#16894

@directhex
Copy link
Contributor

It looks like parsing data/UnixFilePermissions.xml was added a week ago: dotnet/sdk@5305f48 which ties in with @akoeplinger's link

I'll look at adding that file to the blazor workload pack, probably based on the template from Android (dotnet/android#6010)

directhex added a commit to directhex/emsdk that referenced this issue Jun 21, 2021
…ot executable by the end user:

```
-rwxr--r--  1 root  wheel   106K May 31 07:30 /usr/local/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.osx-x64/6.0.0-preview.5.21281.1/tools/bin/llc
```

Ref: dotnet/runtime#54501
Ref: dotnet/runtime#53545
Ref: dotnet/sdk#16894
Ref: xamarin/xamarin-macios#11869
Ref: dotnet/android#6010
directhex added a commit that referenced this issue Jun 21, 2021
* Add UnixFilePermissions.xml for Mono AOT compilers

Ref: #53545
Ref: dotnet/sdk#16894
Ref: xamarin/xamarin-macios#11869
Ref: dotnet/android#6010

* Only set permissions on !windows
@ghost ghost locked as resolved and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-android os-ios Apple iOS
Projects
None yet
Development

No branches or pull requests

5 participants