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

Re: [bug] $scalar[(pws[\0])1] or $scalar[(pws[á])1] doesn't work



> 2022/11/18 21:25, Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> 
> It seems the problems are not limited to the s subscript flag.
> 
> $ ltrace -e getpwnam zsh -c "u=$'st\u00e9ph\u00e1ne';  echo *(u:\$u:)"
> zsh->getpwnam("st\303\251ph\303\203\201ne")                                                       = 0
> zsh:1: unknown username 'stépháne'
> +++ exited (status 1) +++
> 
> See \241 changed to \203\201 in the call to getpwnam().
> 
> The error message has the correct name though.

I think this is a different problem.
Could you try the following patch?

diff --git a/Src/glob.c b/Src/glob.c
index 400be12d5..66ef8d53d 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -1481,7 +1481,7 @@ zglob(LinkList list, LinkNode np, int nountok)
 			    sav = *tt;
 			    *tt = '\0';
 
-			    if ((pw = getpwnam(s + arglen)))
+			    if ((pw = getpwnam(unmetafy(s + arglen, NULL))))
 				data = pw->pw_uid;
 			    else {
 				zerr("unknown username '%s'", s + arglen);






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