Repository navigation
Closed
Description
Description
@davidortinau was testing .NET 8 preview 1 builds and hit the error:
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/16.2.232-net8-p1/targets/Xamarin.Shared.Sdk.targets(1037,3): error MSB4018: The "AOTCompile" task failed unexpectedly.
System.AggregateException: One or more errors occurred. (One or more errors occurred. (An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/8.0.0-preview.1.23106.5/Sdk/../tools/mono-aot-cross' with working directory '/Users/dmo/work/ControlGallery/src/ControlGallery'. Permission denied))
---> System.AggregateException: One or more errors occurred. (An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/8.0.0-preview.1.23106.5/Sdk/../tools/mono-aot-cross' with working directory '/Users/dmo/work/ControlGallery/src/ControlGallery'. Permission denied)
---> System.ComponentModel.Win32Exception (13): An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/8.0.0-preview.1.23106.5/Sdk/../tools/mono-aot-cross' with working directory '/Users/dmo/work/ControlGallery/src/ControlGallery'. Permission denied
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at Xamarin.Utils.Execution.<>c__DisplayClass24_1.<RunAsync>b__0() in /Users/builder/azdo/_work/1/s/xamarin-macios/tools/common/Execution.cs:line 103
--- End of stack trace from previous location ---
at Xamarin.MacDev.Tasks.XamarinTask.ExecuteAsync(String fileName, IList`1 arguments, String sdkDevPath, Dictionary`2 environment, Boolean mergeOutput, Boolean showErrorIfFailure, String workingDirectory) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs:line 120
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Xamarin.MacDev.Tasks.AOTCompileTaskBase.<>c__DisplayClass36_0.<Execute>b__7(Task`1 v) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompileTaskBase.cs:line 108
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
at Xamarin.MacDev.Tasks.AOTCompileTaskBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompileTaskBase.cs:line 115
at Xamarin.MacDev.Tasks.AOTCompile.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompile.cs:line 14
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/Users/dmo/work/ControlGallery/src/ControlGallery/ControlGallery.csproj]
We found that running this fixed it:
chmod +x /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/8.0.0-preview.1.23106.5/tools/mono-aot-cross
The Android/iOS workloads define a data/UnixFilePermission.xml file, so that dotnet workload commands can supply the execute bit. Details at: dotnet/sdk#16894
We think this was implemented sometime in dotnet/runtime: #54501
But I don't see the file here:
Reproduction Steps
- Install .NET 8 Preview 1 MAUI bits: https://gist.github.com/jonathanpeppers/99961b4639823206c2537c03c856b097
dotnet new maccatalystdotnet build
Expected behavior
You should not need to chmod +x mono-aot-cross
Actual behavior
Some Mac machines you have to chmod +x mono-aot-cross.
Regression?
Yes
Known Workarounds
chmod +x /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64/8.0.0-preview.1.23106.5/tools/mono-aot-cross
Configuration
.NET SDK 8.0.100-preview.1.23109.10
Other information
No response
Activity
jonathanpeppers commentedon Feb 15, 2023
/cc @steveisok
steveisok commentedon Feb 15, 2023
@directhex, not sure how this regressed. Please look into it.
directhex commentedon Feb 15, 2023
This change was made intentionally in b6e2dbe which was part of #75200
@radical do you know what spurred the "non-Windows no longer needs execute permissions" change?
radical commentedon Feb 15, 2023
Nuget should have the correct permissions now, that was my understanding.
radical commentedon Feb 15, 2023
hm looks like that depends on this file though?
directhex commentedon Feb 15, 2023
Where does Nuget get the correct permissions from? The underlying .zip format doesn't support permissions without non-standard extended attributes which afaik aren't supported in dotnet's zip implementation
directhex commentedon Feb 15, 2023
(making every extracted file executable is one approach which doesn't rely on attributes or a metadata xml)
radical commentedon Feb 15, 2023
IIRC, dotnet's zip implementation had fixes for that, and thus this wasn't required any more. but maybe I misunderstood some part of it.
directhex commentedon Feb 15, 2023
It looks like #70735 went in which guarantees permissions on files are read-write and directories are read-write-execute. I don't see anything in that change about adding execute permissions to files.
5 remaining items
directhex commentedon Feb 15, 2023
OK, there's a
-Zflag tounzipto validate it with.note the lack of x on the files in tools/
steveisok commentedon Feb 15, 2023
No, it's too late unfortunately.
lewing commentedon Feb 15, 2023
lets revert the change asap and add known-issues to the release notes
Workloads: Fix a regression in file permissions for workload packs
radical commentedon Feb 15, 2023
@davidortinau @jonathanpeppers How was this workload installed?
jonathanpeppers commentedon Feb 15, 2023
The gist above has instructions, but it was a regular dotnet workload install command.
radical commentedon Feb 16, 2023
/usr/local/share/dotnetcompletelydotnet-sdk-8.0.100-preview.1.23109.10-osx-arm64.pkg.sudo dotnet workload install maui --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/9567bfa68859d611cc9aad2555fd9847f8233cda.json --verbosity diag.All of the files have
+xset!directhex commentedon Feb 16, 2023
@radical try executing one of those as non-root 🙃
radical commentedon Feb 16, 2023
Lol root owned and u+x, duh! 😬
directhex commentedon Feb 16, 2023
🙈
Workloads: Fix a regression in file permissions for workload packs (#…