fix(uucore): Use embedded locales in release mode.#9879
fix(uucore): Use embedded locales in release mode.#9879lordeji wants to merge 2 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
Merging this PR will improve performance by 13.21%
Performance Changes
Comparing 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: |
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 ! |
Basically:
is that clear? |
So, why PR #8604 was merged ? It specifically add support for embedding non english locales. |
|
@sylvestre really sorry for pinging but I think that we really need to resolve the misunderstanding. |
|
sorry, i need to spend time on it and i didn't find time to work on it. However, happy to get help and more investigations on this :) |
|
@sylvestre Looking back on issue #8594, your instructions were :
I'm assuming that you changed your mind because the main problem now is the issue #9103. If so, I'll close this PR. |
- 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.
2e2305e to
0baf12c
Compare
|
Should we embedded Eng+1 system lang? It is bit complex to maintain. |
|
Sorry, what means eng+1? :) |
|
eng + 1 where 1 is set by |
|
GNU testsuite comparison: |
|
@oech3 I know this is a weird question but i'm new to contributing to open-source and I'm far from having all the required knowledge. It's just that I see you being there for l10n and i18n related issues so I wondered if you're a maintainer specialized in this ? If so, do you have more insight on this misunderstanding ? Again, really sorry for the message, it's just that I dont know what to do and you seems the one to know the best about the l10n system. |
|
Sorry, I'm not a maintainer and collaborator. I can't decide what should we do. |
|
@oech3 ok ok, really sorry for bothering you, i'm juste a bit lost... |
|
I am confusing too. |
|
Me too :) |
|
@sylvestre There is 2 possibilities :
In my opinion, we should solve how packagers/distribution could make use of this because embedding the system locale can only be done at build time and would lead to multiple packages (like For now, in this configuration, I think embedding system locale is not useful until we find a way for the packagers/distribution to make use of it. The choice is yours Mr LEDRU. |
|
@sylvestre If you want to support reproducible build not depending on system config, please allow doing 2. |
|
I'm converting all my PRs to drafts. |
@lordeji get well soon. |
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.