From f2a9e1442683478c8a86b0c38eca596817396a60 Mon Sep 17 00:00:00 2001 From: lotherk Date: Wed, 18 Nov 2026 12:28:02 +0000 Subject: [PATCH] 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). --- programs/dtlogin/verify.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/programs/dtlogin/verify.c b/programs/dtlogin/verify.c index fa2abb30..8ba6ea08 100644 --- a/programs/dtlogin/verify.c +++ b/programs/dtlogin/verify.c @@ -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)