dtlogin: LANG before PATH in the session environment (ksh93 dropped it)

The session ran with LANG=C although dtlogin passed LANG=en_US.UTF-8 to
Xsession (dtlogin -debug 3: 'LANG=en_US.UTF-8'; ps -e on Xsession showed it).
Xsession is a ksh93 script, and ksh93 93u+m 1.0.10 on NetBSD rejects LANG as
'en_US.UTF-8: unknown locale' and leaves it empty when PATH comes earlier in
the environment (put_lang -> libast setlocale); Xsession then set LANG=C.
Measured in the installed system: env -i PATH=/bin:/usr/bin LANG=en_US.UTF-8
ksh93 -> empty, LANG before PATH -> kept, no PATH -> kept.  verify.c now
creates LANG right after LOGNAME; setLang() replaces the value in place.

Tests: test-desktop-login's LOGIN and CORES checks matched padded ps and wc
output ('CORES= 0'); install-simple's .local lookup is bounded to 5 s per
round (the loop outlasted ENDCHK's 300 s without a network).
This commit is contained in:
lotherk committed 2026-11-18 12:28:02 +00:00
1 parent b6cbd0eb87
commit f2a9e14426
1 file changed
+11
+11
View File
@@ -339,6 +339,17 @@ userEnv(
#else
env = 0;
env = setEnv (env,"LOGNAME", user);
/*
* MCDE: LANG before PATH. Xsession is a ksh93 script, and ksh93
* (93u+m 1.0.10 on NetBSD) rejects LANG as "unknown locale" and
* leaves it empty when PATH comes earlier in the environment;
* Xsession then set LANG=C for the whole session. Measured in the
* installed system 2026-11-18: env -i PATH=/bin:/usr/bin
* LANG=en_US.UTF-8 ksh93 -> LANG empty; LANG first -> kept.
* setEnv() replaces in place, so setLang() below only sets the value.
*/
if (d->language && strlen(d->language) > 0)
env = setEnv (env, "LANG", d->language);
#endif
for (exp = exportList; exp && *exp; ++exp)