Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug when $USERNAME is cyryllic
- X-seq: zsh-workers 52195
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Максим <herobrine135111@xxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: Bug when $USERNAME is cyryllic
- Date: Sun, 1 Oct 2023 13:35:23 -0700
- Archived-at: <https://zsh.org/workers/52195>
- In-reply-to: <CAHJ=x4ajbNr2ufWi3BX-kHfA1pijEJ=L0ZVbQznHMk8xNE==Lg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <816a211e-3907-420e-9c1d-d6489f805d7f@Spark> <CAH+w=7ZQc41R2QiNDKiT4gf-WFqOgVEMU8Z3uMx=vrpBt9f0uA@mail.gmail.com> <CAHJ=x4ajbNr2ufWi3BX-kHfA1pijEJ=L0ZVbQznHMk8xNE==Lg@mail.gmail.com>
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