zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Максим <herobrine135111@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: Bug when $USERNAME is cyryllic
Date: Sun, 1 Oct 2023 13:35:23 -0700	[thread overview]
Message-ID: <CAH+w=7bGPHpLULpUetGaMTPqm7VibEB6Wtox8VW-pPGpkgrdFw@mail.gmail.com> (raw)
In-Reply-To: <CAHJ=x4ajbNr2ufWi3BX-kHfA1pijEJ=L0ZVbQznHMk8xNE==Lg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

On Sun, Oct 1, 2023 at 11:55 AM Максим <herobrine135111@gmail.com> 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().

[-- Attachment #2: meta-logname.txt --]
[-- Type: text/plain, Size: 629 bytes --]

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 *

  reply	other threads:[~2023-10-01 20:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-01  5:04 Максим Щербаков
2023-10-01  7:04 ` Ellenor Bjornsdottir
2023-10-01  7:17   ` Максим Щербаков
2023-10-01 18:05 ` Bart Schaefer
2023-10-01 18:54   ` Максим
2023-10-01 20:35     ` Bart Schaefer [this message]
2023-10-02  4:50       ` Максим
2023-10-02 10:28       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7bGPHpLULpUetGaMTPqm7VibEB6Wtox8VW-pPGpkgrdFw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=herobrine135111@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).