sudo doesn't strip quotes from /etc/environment
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sudo |
Unknown
|
Unknown
|
|||
localechooser (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
sudo (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Hi
localechooser writes /etc/default/locale with quotes protecting LANG and LANGUAGE; typically after an install the file contains something like:
LANG="en_US.UTF-8"
however pam_env expects VAR=VALUE lines, without quotes. This causes LANG to be set literally to "en_US.UTF-8" with the quotes; this is of course not a valid locale name.
[ I raised this bug to Michael Vogt during UDS as I was seeing this after using language-selector, he fixed language-selector to write LANG=foo instead of LANG="foo", but this only fixes the issue for people who will run language-selector in the future. ]
I believe we should change pam_env to strip quotes, perhaps only for certain env vars; we can also change localechooser to stop using quotes for new installs.
Cheers
Related branches
description: | updated |
summary: |
- pam_env's and localechooser's usage of quotes for /etc/default/locale - conflicts + sudo doesn't strip quotes from /etc/environment |
As far as I can see, pam_env already strips quotes. Here's the code:
/* now we try to be smart about quotes around the value,
key[ i++] = key[t];
else if (key[t+1] != '\0')
key[ i++] = key[t];
but not too smart, we can't get all fancy with escaped
values like bash */
if (key[i] == '=' && (key[++i] == '\"' || key[i] == '\'')) {
for ( t = i+1 ; key[t] != '\0' ; t++)
if (key[t] != '\"' && key[t] != '\'')
key[i] = '\0';
}
Is this not working for you?