Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 283725 - >=sys-apps/shadow-4.1.3.1 reset LC_ALL, LANG, LANGUAGE when using "su"
Summary: >=sys-apps/shadow-4.1.3.1 reset LC_ALL, LANG, LANGUAGE when using "su"
Status: VERIFIED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
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: ---


Attachments
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-4.1.3.1 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-4.1.2.2) 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:
non-working:
1. emerge >=sys-apps/shadow-4.1.3.1
2. type "su"
3. echo $LC_ALL

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

working:
1. emerge =sys-apps/shadow-4.1.2.2
2. type "su"
3. echo $LC_ALL
Comment 1 parafin 2009-12-03 15:58:50 UTC
Upstream bug: https://alioth.debian.org/tracker/index.php?func=detail&aid=311740&group_id=30580&atid=411480
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-4.1.4.2-r1 (04 Dec 2009)
+
+  04 Dec 2009; Fabio Erculiani <lxnay@gentoo.org> -shadow-4.1.3.1.ebuild,
+  -shadow-4.1.4.1.ebuild, -shadow-4.1.4.2.ebuild, +shadow-4.1.4.2-r1.ebuild,
+  +files/shadow-4.1.4.2-env-reset-keep-locale.patch:
+  Fix invalid environment variables reset, close bug #283725, thanks to
+  myself for reporting, thanks to parafin for providing a working patch
+