Repository navigation
Add only the chosen locale instead of rebuilding them all - #16414
Conversation
locale-gen ignores its argument: it deletes /usr/lib/locale/locale-archive and rebuilds every locale.gen entry, ignoring each localedef failure. On a nearly full disk that drops locales the machine already had and still exits 0, so omarchy language switched to a locale that was never built. localedef now adds just this one, honouring a /usr/local source override as locale-gen does, and the helper asks the archive whether it landed, because localedef exits 1 both for warnings and for a locale it could not add. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The PR appears safe to merge; no actionable issues remain. SummaryReplaces the archive-wide
No new actionable issues found. Both previous unnumbered findings are addressed. Tests were not run. Reviews (5) · Last reviewed commit: "Run the checkout's locale helper in the ..." · Reviewed by Greptile |
…t reason The helper looks for a source under /usr/local/share/i18n/locales on whatever machine runs the test, so the exact `-i sv_SE` and `-i hi_IN` assertions failed on a host with an override there although the helper chose correctly. They now accept the override path as well as the packaged name. The failure-path cases only checked the exit status, so a helper that refused `da` before ever calling localedef passed them. Each case now also checks localedef was asked for da_DK.UTF-8. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
localedef reads a bare-named source like sv_SE from the working directory before its installed locales, and sudo keeps the caller's directory. Through the passwordless rule, any process running as the user could plant a sv_SE there and have root compile it into the system locale archive, which the rule's own comment says it cannot do. The helper now changes to / once it holds root, beside the PATH pin that guards against the same kind of input. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It only checked that the line was there, which the house rules say not to test. The unprivileged suite cannot run the helper as root, so the cwd hardening is shown on a worker instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed at 5fa4070 against Reproduction. I put a tmpfs over Pushed:
Nothing is left for the author. The description doesn't yet mention the Second opinion: Codex at medium effort and muse-spark-1.3 via pi at high thinking, over three rounds.
Both reviewers can read this session's work, so their agreement isn't independent. This waits on the maintainer. Once it lands it conflicts textually with #16275 and #16320, which edit the comment above the registry lookup in the same helper. |
quattro moved the sudoers rule and root PATH checks from locale-sudoers-test.sh into sudoers-test.sh. Keep that split and this branch's localedef fixtures.
The locale helper no longer calls locale-gen, so poison the tool it does call and say what the sv probe now fails to write.
omarchy-language asks sudo or pkexec for /usr/bin/omarchy-locale-generate, so wherever Omarchy is installed the test exercised the packaged helper. An older one called the real locale-gen, which the test no longer stubs, and failed. The elevation stubs now run this checkout's copy. Co-Authored-By: Codex gpt-6.1-sol <noreply@openai.com>
* Add only the chosen locale instead of rebuilding them all locale-gen ignores its argument: it deletes /usr/lib/locale/locale-archive and rebuilds every locale.gen entry, ignoring each localedef failure. On a nearly full disk that drops locales the machine already had and still exits 0, so omarchy language switched to a locale that was never built. localedef now adds just this one, honouring a /usr/local source override as locale-gen does, and the helper asks the archive whether it landed, because localedef exits 1 both for warnings and for a locale it could not add. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Make the locale-generate tests hold on any host and fail for the right reason The helper looks for a source under /usr/local/share/i18n/locales on whatever machine runs the test, so the exact `-i sv_SE` and `-i hi_IN` assertions failed on a host with an override there although the helper chose correctly. They now accept the override path as well as the packaged name. The failure-path cases only checked the exit status, so a helper that refused `da` before ever calling localedef passed them. Each case now also checks localedef was asked for da_DK.UTF-8. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Leave the caller's directory before generating a locale as root localedef reads a bare-named source like sv_SE from the working directory before its installed locales, and sudo keeps the caller's directory. Through the passwordless rule, any process running as the user could plant a sv_SE there and have root compile it into the system locale archive, which the rule's own comment says it cannot do. The helper now changes to / once it holds root, beside the PATH pin that guards against the same kind of input. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the test that greps the helper for its own cd It only checked that the line was there, which the house rules say not to test. The unprivileged suite cannot run the helper as root, so the cwd hardening is shown on a worker instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Name localedef in the root PATH probe instead of locale-gen The locale helper no longer calls locale-gen, so poison the tool it does call and say what the sv probe now fails to write. * Run the checkout's locale helper in the language test omarchy-language asks sudo or pkexec for /usr/bin/omarchy-locale-generate, so wherever Omarchy is installed the test exercised the packaged helper. An older one called the real locale-gen, which the test no longer stubs, and failed. The elevation stubs now run this checkout's copy. Co-Authored-By: Codex gpt-6.1-sol <noreply@openai.com> --------- Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-authored-by: Codex Medium <noreply@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Ryan Hughes <ryan@heyoodle.com> (cherry picked from commit 9e0b5e2)
omarchy language <code>generates the language's locale throughbin/omarchy-locale-generate, which ranlocale-gen "$locale". Arch'slocale-genignores its argument: it deletes/usr/lib/locale/locale-archive, rebuilds every entry in/etc/locale.gen, and swallows eachlocaledeffailure with|| :. On a nearly full disk the rebuild runs out of room part way, so locales the machine already had disappear, the helper still exits 0, andomarchy-languageswitches to a locale that was never built. Because the helper runs through the passwordless sudoers rule, a pick from Setup > Language is enough to trigger it. Any locale someone generated by hand without listing it inlocale.genwas also lost on every language change, full disk or not.The helper now adds only the chosen locale with
localedef, with the same flagslocale-genuses, and leaves the rest of the archive alone. It picks the locale source the waylocale-gendoes, so a definition under/usr/local/share/i18n/localesstill wins over the packaged one. It then checkslocaledef --list-archivefor the locale rather than trusting the exit status:localedefexits 1 both for warnings and when it could not add the locale to a full archive ("cannot add to locale archive"), so the status alone can't tell success from failure. When the locale is missing the helper fails, andomarchy-languageleaves the language as it was.On an Omarchy worker with
da_DK,en_US,fr_FRandja_JPgenerated and 0–256 KB free under/usr/lib/locale,omarchy-locale-generate deonquattroexited 0 and droppedja_JP. With this change it exits 1 and all four stay. The tests stublocaledefinstead oflocale-gen, cover alocale.genentry written without its codeset (hi_IN UTF-8), and cover a locale thatlocaledefdid not add while exiting 1, 4 or 135.Reviewed by Codex at medium effort and by muse-spark-1.3 via pi at high thinking. Neither left anything open.
Fixes #16244