-
Notifications
You must be signed in to change notification settings - Fork 267
fix(terminal): stop forcing en_US.UTF-8 in execa command environment #1481
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
Open
mmskazak
wants to merge
3
commits into
Zoo-Code-Org:main
Choose a base branch
from
mmskazak:fix/execa-terminal-locale-override
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "zoo-code": patch | ||
| --- | ||
|
|
||
| Fix commands run by Zoo Code forcing `LANG`/`LC_ALL` to `en_US.UTF-8` even when the system already has a correctly configured non-US UTF-8 locale (e.g. `en_AU.UTF-8`), which caused a `setlocale: LC_ALL: cannot change locale` warning on every command for anyone whose system locale isn't `en_US.UTF-8`. The existing locale is now preserved when it already specifies a UTF-8 encoding; only an unset locale or an encoding-less POSIX default (`C`/`POSIX`) falls back to `en_US.UTF-8`, and a locale with a non-UTF-8 encoding has its encoding upgraded while its language/territory is kept. |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: Zoo-Code-Org/Zoo-Code
Length of output: 16446
🌐 Web query:
POSIX locale environment LC_ALL empty value precedence LANG LC_* Base Definitions💡 Result:
In POSIX environments, the determination of locale categories follows a strictly defined precedence order [1][2]. If an environment variable is unset or set to the empty string, it is treated as if it were not defined for the purpose of the precedence rules, effectively falling through to the next level in the hierarchy [1][3][2]. The precedence order, from highest to lowest, is as follows [2][4]: 1. LC_ALL: If this variable is defined and is not null (not empty), it overrides all other locale environment variables and determines the value for all locale categories [5][6][2]. 2. LC_: If LC_ALL is unset or empty, the individual category-specific environment variables (e.g., LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) are used for their respective categories, provided they are defined and not null [2][7]. 3. LANG: If neither LC_ALL nor the specific LC_ variable is set (or if they are empty), the value of the LANG environment variable is used [6][2]. 4. Implementation-defined default: If LANG is also unset or set to the empty string, the system uses an implementation-defined default locale (often the POSIX or C locale) [1][3][2]. In summary, an empty value for any of these variables causes the system to ignore that variable and proceed to the next lower level of precedence [1][3][2].
Citations:
Do not normalize an empty
LC_ALLinto a fallback override.When
process.env.LC_ALL === "", the current condition addsLC_ALL: "en_US.UTF-8"to the child environment. This non-empty value overridesLANG. Guard on a non-empty value and add a regression test.🤖 Prompt for AI Agents