Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 283725 - >=sys-apps/shadow- reset LC_ALL, LANG, LANGUAGE when using "su"
Summary: >=sys-apps/shadow- reset LC_ALL, LANG, LANGUAGE when using "su"
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2009-09-05 07:46 UTC by Fabio Erculiani (RETIRED)
Modified: 2009-12-04 23:29 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

fixes mistype in libmisc/env.c (keep_locale.patch,466 bytes, patch)
2009-12-04 13:21 UTC, parafin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Erculiani (RETIRED) gentoo-dev 2009-09-05 07:46:15 UTC
When typing "su" (and NOT "su -" -- which works) using /bin/su from >=sys-apps/shadow- environment variables LC_ALL, LANG, LANGUAGE are unset.
I'm trying to figure out where's the problem looking at source code but the difference between the last working version (sys-apps/shadow- and the first one failing is really big.

I consider this issue quite critical because changing locale settings affects nl_langinfo() and thus Python's sys.getfilesystemencoding() return value, so any application supporting unicode and relying on that function could die unexpectedly.

Reproducible: Always

Steps to Reproduce:
1. emerge >=sys-apps/shadow-
2. type "su"
3. echo $LC_ALL

working (see "su -"):
1. emerge >=sys-apps/shadow-
2. type "su -"
3. echo $LC_ALL

1. emerge =sys-apps/shadow-
2. type "su"
3. echo $LC_ALL
Comment 1 parafin 2009-12-03 15:58:50 UTC
Upstream bug:
It was opened for half a year now, so I think Gentoo should patch this issue itself. Patch is provided in the above bug report, but I haven't checked it out, because it seems that registration is needed. Anyway it is a very small fix, and if needed I can make patch myself and upload it here.
Comment 2 Fabio Erculiani (RETIRED) gentoo-dev 2009-12-04 08:44:19 UTC
Please attach the patch here for review.
Comment 3 parafin 2009-12-04 13:21:30 UTC
Created attachment 212009 [details, diff]
fixes mistype in libmisc/env.c

I made this patch, but I think it's an exact copy of one in the upstream bug report. I tested it and it works.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-12-04 20:17:46 UTC
After reviewing the upstream source, +1 from me.
The code in there is horrible, sanitize_env seems to be O(N^2) when it could be O(N) instead.
Comment 5 Fabio Erculiani (RETIRED) gentoo-dev 2009-12-04 23:28:52 UTC
Thanks everybody involved here, I applied the patch and revision bumped sys-apps/shadow ~arch. I also removed older ~arch versions.

+*shadow- (04 Dec 2009)
+  04 Dec 2009; Fabio Erculiani <> -shadow-,
+  -shadow-, -shadow-, +shadow-,
+  +files/shadow-
+  Fix invalid environment variables reset, close bug #283725, thanks to
+  myself for reporting, thanks to parafin for providing a working patch