Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug when $USERNAME is cyryllic



On Sun, Oct 1, 2023 at 11:55 AM Максим <herobrine135111@xxxxxxxxx> wrote:
>
>     env -i LANG=C =zsh-5.9.0.1-dev -fc 'cd; echo "$USERNAME | ${(%):-%n} | $LOGNAME"'
>
> Now results in:
>
>     Студент | Студент | Ѓ�ту�дент

This should fix that.

Aside, my recollection was wrong:  It's tokenize() that appears
harmless to apply more than once, not metafy().
diff --git a/Src/params.c b/Src/params.c
index 50e8627d1..957656e3f 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -850,12 +850,11 @@ createparamtable(void)
     setsparam("HOST", ztrdup_metafy(hostnam));
     zfree(hostnam, 256);
 
-    setsparam("LOGNAME", ztrdup_metafy(
+    setsparam("LOGNAME",
 #ifndef DISABLE_DYNAMIC_NSS
-			(str = getlogin()) && *str ?  str :
+	      (str = getlogin()) && *str ? ztrdup_metafy(str) :
 #endif
-				cached_username
-			));
+	      ztrdup(cached_username));
 
 #if !defined(HAVE_PUTENV) && !defined(USE_SET_UNSET_ENV)
     /* Copy the environment variables we are inheriting to dynamic *


Messages sorted by: Reverse Date, Date, Thread, Author