Skip to content

Conversation

@jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Jun 7, 2021

Context: dotnet/sdk#16894

There is currently a workaround in place, so that executables inside a
.NET workload have the right permissions:

https://github.com/dotnet/sdk/pull/17299/files

A new data/UnixFilePermissions.xml file will be required to define
permissions such as:

<FileList>
  <File Path="tools/Darwin/aapt2" Permission="755" />
</FileList>

I am putting this in place before the changes to dotnet workload install actually land.

We also found these files should be removed from our .NET workload
packs:

  • aprofutil
  • mono
  • mono-symbolicate

@jonathanpeppers jonathanpeppers force-pushed the dotnet-unixfilepermissions branch from 0b9b1ce to 801778b Compare June 8, 2021 19:53
@jonathanpeppers jonathanpeppers marked this pull request as draft June 8, 2021 19:54
@jonathanpeppers jonathanpeppers marked this pull request as ready for review June 9, 2021 03:46
@jonathanpeppers
Copy link
Member Author

Final file is:

<FileList>
  <File Path="tools/Darwin/illinkanalyzer" Permission="755" />
  <File Path="tools/Darwin/jit-times" Permission="755" />
  <File Path="tools/Darwin/aprofutil" Permission="755" />
  <File Path="tools/Darwin/mono-symbolicate" Permission="755" />
  <File Path="tools/Darwin/ndk/aarch64-linux-android-as" Permission="755" />
  <File Path="tools/Darwin/ndk/aarch64-linux-android-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/aarch64-linux-android-strip" Permission="755" />
  <File Path="tools/Darwin/ndk/arm-linux-androideabi-as" Permission="755" />
  <File Path="tools/Darwin/ndk/arm-linux-androideabi-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/arm-linux-androideabi-strip" Permission="755" />
  <File Path="tools/Darwin/ndk/i686-linux-android-as" Permission="755" />
  <File Path="tools/Darwin/ndk/i686-linux-android-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/i686-linux-android-strip" Permission="755" />
  <File Path="tools/Darwin/ndk/x86_64-linux-android-as" Permission="755" />
  <File Path="tools/Darwin/ndk/x86_64-linux-android-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/x86_64-linux-android-strip" Permission="755" />
  <File Path="tools/Darwin/mono" Permission="755" />
  <File Path="tools/Darwin/aapt2" Permission="755" />
</FileList>

Copy link
Contributor

@dellis1972 dellis1972 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shame Nuget doesn't use a good ZipLibrary which would preserve the permissions, then we wouldn't have to go through all this stuff :(.

@jonpryor
Copy link
Contributor

jonpryor commented Jun 9, 2021

We should remove aprofutil and mono. We may want to consider removing mono-symbolicate.

Additionally, is it possible to sort the file contents? :-)

Context: dotnet/sdk#16894

There is currently a workaround in place, so that executables inside a
.NET workload have the right permissions:

https://github.com/dotnet/sdk/pull/17299/files

A new `data/UnixFilePermissions.xml` file will be required to define
permissions such as:

    <FileList>
      <File Path="tools/Darwin/aapt2" Permission="755" />
    </FileList>

I generated this file based on existing item groups in
`create-installers.targets`.

I am putting this in place before the changes to `dotnet workload
install` actually land.

We also found these files should be *removed* from our .NET workload
packs:

* `aprofutil`
* `mono`
* `mono-symbolicate`
@jonathanpeppers jonathanpeppers force-pushed the dotnet-unixfilepermissions branch from 6890897 to 6fda0ef Compare June 9, 2021 16:29
@jonathanpeppers
Copy link
Member Author

Latest file is:

<FileList>
  <File Path="tools/Darwin/aapt2" Permission="755" />
  <File Path="tools/Darwin/illinkanalyzer" Permission="755" />
  <File Path="tools/Darwin/jit-times" Permission="755" />
  <File Path="tools/Darwin/ndk/aarch64-linux-android-as" Permission="755" />
  <File Path="tools/Darwin/ndk/aarch64-linux-android-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/aarch64-linux-android-strip" Permission="755" />
  <File Path="tools/Darwin/ndk/arm-linux-androideabi-as" Permission="755" />
  <File Path="tools/Darwin/ndk/arm-linux-androideabi-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/arm-linux-androideabi-strip" Permission="755" />
  <File Path="tools/Darwin/ndk/i686-linux-android-as" Permission="755" />
  <File Path="tools/Darwin/ndk/i686-linux-android-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/i686-linux-android-strip" Permission="755" />
  <File Path="tools/Darwin/ndk/x86_64-linux-android-as" Permission="755" />
  <File Path="tools/Darwin/ndk/x86_64-linux-android-ld" Permission="755" />
  <File Path="tools/Darwin/ndk/x86_64-linux-android-strip" Permission="755" />
</FileList>

aprofutil, mono, mono-symbolicate are removed.

The Windows package, no longer has data/UnixFilePermissions.xml at all.

@jonpryor
Copy link
Contributor

jonpryor commented Jun 10, 2021

Context: https://github.com/dotnet/sdk/issues/16894
Context: https://github.com/dotnet/sdk/pull/17299

On non-Windows platforms, the `dotnet workload install` command needs
to ensure that certain files are executable after extracting them
from the workload package, via `chmod 755 FILE`.  This is currently
done for all files in the `tools` folder for [select workloads][0].

dotnet/sdk/#16894 proposes using a new `data/UnixFilePermissions.xml`
file to explicitly specify which files within the workload should
have which Unix file permissions applied:

	<FileList>
	  <File Path="tools/Darwin/aapt2" Permission="755" />
	</FileList>

Update `Microsoft.Android.Sdk.proj` to create a
`data/UnixFilePermissions.xml` file, when building .NET 6+ installers
on Linux and macOS platforms.  `UnixFilePermissions.xml` is generated
with the new `<GenerateUnixFilePermissions/>` task, building upon the
`@(AndroidSdkBuildTools)` & related item groups in
`create-installers.targets`.

This is being done *before* `dotnet workload install` is updated to
use `data/UnixFilePermissions.xml`.

We also found that the following files should be *removed* from our
.NET workload packs:

  * `aprofutil`
  * `mono`
  * `mono-symbolicate`

`aprofutil` is needed for AOT use, and AOT is not currently supported
under .NET 6.

`mono` was only needed for `jnimarshalmethod-gen.exe`, which doesn't
work on .NET 6, and `mono-symbolicate` *should* come from Mono-related
workload packages, not Android-related packages, and also doesn't work.

[0]: https://github.com/dotnet/sdk/blob/17c734cde97c6dde9d4bf298e7a2a7a342263ce6/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs#L186-L191

@jonpryor jonpryor merged commit 8ad7f52 into dotnet:main Jun 10, 2021
@jonathanpeppers jonathanpeppers deleted the dotnet-unixfilepermissions branch June 10, 2021 18:41
directhex pushed a commit to directhex/runtime that referenced this pull request Jun 21, 2021
directhex pushed a commit to directhex/emsdk that referenced this pull request 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: dotnet/macios#11869
Ref: dotnet/android#6010
directhex added a commit to dotnet/runtime that referenced this pull request Jun 21, 2021
* Add UnixFilePermissions.xml for Mono AOT compilers

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

* Only set permissions on !windows
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants