-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(uucore): Use embedded locales in release mode. #9879
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
base: main
Are you sure you want to change the base?
Conversation
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging #9879 will degrade performance by 4.47%Comparing Summary
Benchmarks breakdown
Footnotes
|
People installing from source does not require all locales, but distibutor still needs all locales. |
|
GNU testsuite comparison: |
7b12e54 to
8b1d9f6
Compare
|
@oech3 Sorry, didn't know this. Rebased without the GNUmakefile commit. |
|
Is non-embedded |
|
GNU testsuite comparison: |
|
@oech3 Not in release mode. |
|
If needed, i can fix the original get_locales_dir() function that was throwing an error in release and then add fallback to .ftl files.
Yes. Needed. Distributor would hope to support all langs at packaging level.
I guess embedding is needed only for default one (and packager should manually set English).
|
|
@oech3 I'm truly sorry for the confusion but it seems that there is conflicting ideas between you and PR #8604.
But embedded (non english) locales were not programmed to be used, making me think there was a bug. |
For performance ? cc: @sylvestre @WaterWhisperer |
|
If fallback is not supported, I think it is bug (at least for packager). |
|
|
GNU testsuite comparison: |
396f6b3 to
b4b55d0
Compare
|
GNU testsuite comparison: |
- Update setup_localization() to have implementation specific to debug or release. - Update create_english_bundle_from_embedded() to not be specific to english. - Update init_localization() to have implementations specific to debug or release. - Delete get_locales_dir() release mode implementation because it was useless.
In "Test Make installation" step, set french locale BEFORE building with make. In "Test Cargo installation" step, add french locale env var before installation. If not, the binary is built with no embedded french locale.
497bd5b to
2e2305e
Compare
|
would it be possible to add a github action check to verify that it works correctly? thanks |
|
also, i worried about the binary size with all locales, did you look at this ? |
|
In my understanding, we fallbacks to nun-embedded ftl instead of embedding all langs to the binary. No? |
|
looking at comment #0 it isn't clear to me :) |
|
@sylvestre @oech3 For the binary size, it shouldn't change anything because PR #8604 was already embedding them. It was the first thing I checked when debugging. I did not fallback to Before making the changes, if that's not too much to ask, could someone write my the EXACT intent of how you want it to works ? There is no real documentation and when I tried
Sorry for the long message but I'm on holidays and I won't have much time to code or answer so the quicker we can resolve misunderstandings, the more efficient I will be. Happy new years by the way ! |
TL;DR
PR #8604 was incomplete. It was indeed embedding the locales but they weren't used and
get_locales_dir()implementation was still looking for a path which throw an error insetup_localization()which force to fallback to english, even if the locales were really embedded.Implementation :
I mainly reformated
setup_localization()andinit_localization()to have implementations specific to debug and release.From what I gathered from the codebase, in debug we look for the
.ftlfiles (and eventually fallback to embedded english) and in release it seems that there was a sort of legacy version that was looking for a folder relative to the executable (which was the source of the error).The debug implementations is mainly the same, the release implementations follows the same structure except that we get the localized text from
get_embedded_locale().The implementation comes from the preexisting function
create_english_bundle_from_embedded()where I replaced the "en-US" identifier to a parameter one.Testing :
For consistency, I tested on 5 packages for each configuration (
cp,split,truncate,mvandls).I was also using the devcontainer provided.
I compiled :
With no error/warning and then ran :
Which would print French help text for all the packages in all mode.
I then ran the tests :
With result :
313 tests run: 312 passed, 1 failed, 2 skippedEdits :
l10n_installation_test) was not set properly. Locale should be set before building or the embedding won't be done.l10n_installation_testwas still throwing an error, I looked back and saw I forgot to update the "Test Cargo installation" step that did not even have locales set.