-
Notifications
You must be signed in to change notification settings - Fork 533
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
Fix unmangling of satellite assembly names #9533
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grendello
requested review from
dellis1972,
jonathanpeppers and
jonpryor
as code owners
November 20, 2024 17:45
dellis1972
approved these changes
Nov 20, 2024
grendello
force-pushed
the
dev/grendel/satellite-assembly-name-fix
branch
from
November 21, 2024 10:14
9eef8f7
to
c3ab3f7
Compare
dellis1972
approved these changes
Nov 21, 2024
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Fixes: #9532 Context: 86260ed All the assemblies are wrapped in a valid ELF shared library image and placed in the `lib/{ABI}` directories inside the APK/AAB archive. Since those directories don't support subdirectories, we need to encode satellite assembly culture in a way that doesn't use the `/` directory separator char. This encoding, as originally implemented, unfortunately used the `-` character which made it ambiguous with culture names that consist of two parts (e.g. `de-DE`), since the unmangling process would look for the first occurrence of `-` to replace it with `/`, which would form invalid assembly names such as `de/DE-MyAssembly.resources.dll` instead of the correct `de-DE/MyAssembly.resources.dll`. This would, eventually, lead to a mismatch when looking for satellite assembly for that specific culture. Fix it by changing the `-` character to `_` so that mangled assembly name looks like `lib_de-DE_MyAssembly.resources.dll.so` and we can unambiguously decode it to the correct `de-DE/MyAssembly.resources.dll` name.
Add a test for a compound culture satellite assembly.
grendello
force-pushed
the
dev/grendel/satellite-assembly-name-fix
branch
from
November 22, 2024 11:19
c3ab3f7
to
77d791f
Compare
Fixes: https://github.com/dotnet/android/issues/9532
Context: https://github.com/dotnet/android/pull/9410
Context: 86260ed36dfe1a90c8ed6a2bb1cd0607d637f403
Context: c92702619f5fabcff0ed88e09160baf9edd70f41
In Debug configuration builds, `$(EmbedAssembliesIntoApk)`=false by
default. This enables Fast Deployment in commercial/non-OSS builds.
When `$(EmbedAssembliesIntoApk)`=true, there are two separate ways to
embed assemblies into the `.apk`:
* Assembly Stores (c9270261), which is a "single" (-ish) file that
contains multiple assemblies, enabled by setting
`$(AndroidUseAssemblyStore)`=true.
This is the default behavior for Release configuration builds.
* One file per assembly (86260ed3).
This is the default behavior for Debug configuration builds when
`$(EmbedAssembliesIntoApk)`=true.
Aside: dotnet/android#9410 is an attempt to *remove* support for the
"one file per assembly" packaging strategy, which will *not* be
applied to release/9.0.1xx.
When using the "one file per assembly" strategy, all the assemblies
are wrapped in a valid ELF shared library image and placed in the
`lib/{ABI}` directories inside the APK/AAB archive. Since those
directories don't support subdirectories, we need to encode satellite
assembly culture in a way that doesn't use the `/` directory
separator char.
This encoding, as originally implemented, unfortunately used the `-`
character which made it ambiguous with culture names that consist of
two parts, e.g. `de-DE`, since the unmangling process would look for
the first occurrence of `-` to replace it with `/`, which would form
invalid assembly names such as `de/DE-MyAssembly.resources.dll`
instead of the correct `de-DE/MyAssembly.resources.dll`. This would,
eventually, lead to a mismatch when looking for satellite assembly for
that specific culture.
Fix it by changing the encoding for `/` from `-` to `_`, so that the
mangled assembly name looks like
`lib_de-DE_MyAssembly.resources.dll.so` and we can unambiguously
decode it to the correct `de-DE/MyAssembly.resources.dll` name. |
jonpryor
pushed a commit
that referenced
this pull request
Nov 25, 2024
Fixes: #9532 Context: #9410 Context: 86260ed Context: c927026 In Debug configuration builds, `$(EmbedAssembliesIntoApk)`=false by default. This enables Fast Deployment in commercial/non-OSS builds. When `$(EmbedAssembliesIntoApk)`=true, there are two separate ways to embed assemblies into the `.apk`: * Assembly Stores (c927026), which is a "single" (-ish) file that contains multiple assemblies, enabled by setting `$(AndroidUseAssemblyStore)`=true. This is the default behavior for Release configuration builds. * One file per assembly (86260ed). This is the default behavior for Debug configuration builds when `$(EmbedAssembliesIntoApk)`=true. Aside: #9410 is an attempt to *remove* support for the "one file per assembly" packaging strategy, which will *not* be applied to release/9.0.1xx. When using the "one file per assembly" strategy, all the assemblies are wrapped in a valid ELF shared library image and placed in the `lib/{ABI}` directories inside the APK/AAB archive. Since those directories don't support subdirectories, we need to encode satellite assembly culture in a way that doesn't use the `/` directory separator char. This encoding, as originally implemented, unfortunately used the `-` character which made it ambiguous with culture names that consist of two parts, e.g. `de-DE`, since the unmangling process would look for the first occurrence of `-` to replace it with `/`, which would form invalid assembly names such as `de/DE-MyAssembly.resources.dll` instead of the correct `de-DE/MyAssembly.resources.dll`. This would, eventually, lead to a mismatch when looking for satellite assembly for that specific culture. Fix it by changing the encoding for `/` from `-` to `_`, so that the mangled assembly name looks like `lib_de-DE_MyAssembly.resources.dll.so` and we can unambiguously decode it to the correct `de-DE/MyAssembly.resources.dll` name.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #9532
Context: 86260ed
All the assemblies are wrapped in a valid ELF shared library image and
placed in the
lib/{ABI}
directories inside the APK/AAB archive. Sincethose directories don't support subdirectories, we need to encode
satellite assembly culture in a way that doesn't use the
/
directoryseparator char. This encoding, as originally implemented, unfortunately
used the
-
character which made it ambiguous with culture names thatconsist of two parts (e.g.
de-DE
), since the unmangling process wouldlook for the first occurrence of
-
to replace it with/
, which wouldform invalid assembly names such as
de/DE-MyAssembly.resources.dll
instead of the correct
de-DE/MyAssembly.resources.dll
. This would,eventually, lead to a mismatch when looking for satellite assembly for
that specific culture.
Fix it by changing the
-
character to_
so that mangled assemblyname looks like
lib_de-DE_MyAssembly.resources.dll.so
and we canunambiguously decode it to the correct
de-DE/MyAssembly.resources.dll
name.