Skip to content

Set LC_CTYPE=C.UTF-8 in the default action env#25801

Open
fmeum wants to merge 7 commits intobazelbuild:masterfrom
fmeum:patch-11
Open

Set LC_CTYPE=C.UTF-8 in the default action env#25801
fmeum wants to merge 7 commits intobazelbuild:masterfrom
fmeum:patch-11

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Apr 9, 2025

RELNOTES[INC]: The environment variable LC_CTYPE now defaults to C.UTF-8 for actions that set use_default_shell_env = True, which results in a Unicode-aware locale on most Linux distributions, with MSYS2 as well as macOS 15.4 and higher. Pass --action_env==LC_CTYPE (note the two =s) to explicitly unset this variable, which restores the previous behavior. On older versions of macOS, you can set --action_env=LC_CTYPE=UTF-8 instead.

// Signal Unicode support to locale-aware tools. A samdboxed environment
// without any locale variable set would typically be interpreted as an
// ASCII-only setup, which may not support special characters in filenames.
env.put("LC_CTYPE", "C.UTF-8");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idle thought: since we're setting LC_CTYPE here, should we also have set it instead of the broader LC_ALL in #26279? (OTOH, it's unclear to me that the other LC_* affect the JVM in any way that matters to us.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would have made a difference if we didn't have #17702, I think.

@fmeum fmeum marked this pull request as ready for review July 21, 2025 16:10
@fmeum fmeum requested review from meisterT and removed request for fweikert and gregestren July 21, 2025 16:10
@github-actions github-actions bot added team-Documentation Documentation improvements that cannot be directly linked to other team labels awaiting-review PR is awaiting review from an assigned reviewer labels Jul 21, 2025
@fmeum
Copy link
Collaborator Author

fmeum commented Jul 21, 2025

https://bazelbuild.slack.com/archives/CD3QY5C2X/p1752873180194609 has made me slightly concerned about this change, but I still think it's a net positive: Bazel power users that already use RBE and keep their macOS versions downgraded presumably will be able to figure out that they might need to set --action_env=LC_CTYPE=UTF-8 when they see locale warning. Everyone else benefits from this pretty clearly.

@fmeum fmeum requested a review from tjgq July 21, 2025 16:13
@iancha1992 iancha1992 added the team-Remote-Exec Issues and PRs for the Execution (Remote) team label Jul 22, 2025
@meisterT
Copy link
Member

Do we still want to do this?

@fmeum
Copy link
Collaborator Author

fmeum commented Sep 16, 2025

Yes, I think that it's the better default despite the concern I mentioned above. It makes sense to get the local build experience on a regular up-to-date macOS device right by default and ask more experienced users with specific macOS version requirements to potentially tweak a setting.

@meisterT Could you take over the review?

@fmeum
Copy link
Collaborator Author

fmeum commented Jan 14, 2026

@meisterT friendly ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-Documentation Documentation improvements that cannot be directly linked to other team labels team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants