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-files: don't overwrite existing locale and define default LANG #39264
base: master
Are you sure you want to change the base?
Conversation
2dc7484
to
fb31cff
Compare
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it. |
bump |
Why would this work? Doesn't bash start with /etc/profile, which then sources /etc/profile.d/*? In any case, setting it later in .profile overrides this. |
Because GDM sets LANG and then gnome-session launches bash as a login shell so that This PR adds a check for if LANG is already defined (i.e. by the user/DE/etc) before applying the system-wide preference. |
992fb1b
to
7d281b0
Compare
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it. |
bump |
This feels very crude... I wonder if this would work instead:
|
a25a1ee
to
ab59a16
Compare
I don't think we should be worrying about this. The stuff in Hacking around the fact that GDM expects its forcing of these variables to be respected seems best resolved by looking to |
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it. |
bump |
The parsing of The |
It prevents locale.sh from overwriting e.g. LANG if it was already defined and uses locale.conf as the default values if they are not defined. e.g. |
Thanks; I wasn't reasoning through the assignment properly. There are still problems sanitizing input. For example, if somebody has a file like LANG=en_US.UTF-8 # English it will contain a trailing space after the change but is currently properly parsed. I don't know whether any of the consumers of locale variables would be harmed by the addition of spurious whitespace, but I'd be surprised if this didn't introduce problems. I have not found any documentation on What Red Hat does to interpret the file is an ugly kludge that we should avoid. If anything, I think the Arch way is preferable; just let a pre-set LANG gate the sourcing of the file and, if some users really care about more complex preservation of the whole gamut of variables, they can implement a custom : ${LANG=my-lang} if they need to preserve a pre-set value. Whatever the final form looks like, we should include a manual page or at least fully define on the docs web site what we accept as a valid configuration. |
Thank you for pointing that out.
That was the original way I implemented this PR and people didn't like it.
Personally, I would prefer for that to continue to work as it did before to not break things for people, although I don't think it should be promoted or listed as supported. |
1c6993b
to
5351aa0
Compare
I updated this to only replace plain declarations (e.g. |
I think this is getting far too complicated for the simple intent of preserving variables that have already been set. I had to read that loop several times to figure out what it was doing even knowing your intent. It's also fragile. You're effectively just sourcing the file after wrapping all simple variable assignments in I think there are four reasonable ways to solve your problem (with varying degrees of reasonability):
|
424cf9f
to
7c2ab05
Compare
Here is what I did for that: https://gist.github.com/oreo639/850ddb140df502781f1f54fc1ffaba0c
I pushed a version using that approach, although it will still accept lines that are valid (instead of rejecting the entire file) |
f77b269
to
f599828
Compare
error messages should go to stderr |
Correct spelling of LC_IDENTIFICATION.
Testing the changes
Fixes overwriting user/desktop specified locale.
Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.
You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh
You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)
Closes: #15292