% print -n Ą | xxd -p c484 % touch Ą % zstat -nor -- * | head -1 ă�: % zstat -nor -- * | head -1 | xxd -p | me c483 a43a 0a % Looks like a missing unmetafy()? Cheers, Daniel
[-- Attachment #1: Type: text/plain, Size: 126 bytes --] On Fri, Apr 29, 2022 at 5:42 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote: > > Looks like a missing unmetafy()? Try this? [-- Attachment #2: zstatmeta.txt --] [-- Type: text/plain, Size: 1366 bytes --] diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c index 7c736072b..ce042fced 100644 --- a/Src/Modules/stat.c +++ b/Src/Modules/stat.c @@ -503,8 +503,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (OPT_ISSET(ops,'f')) nargs = 1; else - for (aptr = args; *aptr; aptr++) + for (aptr = args; *aptr; aptr++) { + unmetafy(*args, NULL); nargs++; + } if (OPT_ISSET(ops,'g')) { flags |= STF_GMT; @@ -555,8 +557,8 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) for (; OPT_ISSET(ops,'f') || *args; args++) { char outbuf[PATH_MAX + 9]; /* "link " + link name + NULL */ int rval = OPT_ISSET(ops,'f') ? fstat(fd, &statbuf) : - OPT_ISSET(ops,'L') ? lstat(unmeta(*args), &statbuf) : - stat(unmeta(*args), &statbuf); + OPT_ISSET(ops,'L') ? lstat(*args, &statbuf) : + stat(*args, &statbuf); if (rval) { if (OPT_ISSET(ops,'f')) sprintf(outbuf, "%d", fd); @@ -571,10 +573,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (flags & STF_FILE) { if (arrnam) - *arrptr++ = ztrdup(*args); + *arrptr++ = ztrdup_metafy(*args); else if (hashnam) { *hashptr++ = ztrdup(HNAMEKEY); - *hashptr++ = ztrdup(*args); + *hashptr++ = ztrdup_metafy(*args); } else printf("%s%s", *args, (flags & STF_PICK) ? " " : ":\n"); }
Bart Schaefer wrote on Sat, 30 Apr 2022 04:22 +00:00:
> On Fri, Apr 29, 2022 at 5:42 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>>
>> Looks like a missing unmetafy()?
>
> Try this?
Thanks. Now it works by itself but not when preceded by é:
% zstat -nor -- Ą
Ą:
⋮
% zstat -nor -- é Ą
zstat: Ą: no such file or directory
é:
⋮
%
[-- Attachment #1: Type: text/plain, Size: 162 bytes --] On Fri, Apr 29, 2022 at 9:54 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote: > > Thanks. Now it works by itself but not when preceded by é: Typo, sorry. [-- Attachment #2: zstatmeta2.txt --] [-- Type: text/plain, Size: 1366 bytes --] diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c index 7c736072b..0df9b35b7 100644 --- a/Src/Modules/stat.c +++ b/Src/Modules/stat.c @@ -503,8 +503,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (OPT_ISSET(ops,'f')) nargs = 1; else - for (aptr = args; *aptr; aptr++) + for (aptr = args; *aptr; aptr++) { + unmetafy(*aptr, NULL); nargs++; + } if (OPT_ISSET(ops,'g')) { flags |= STF_GMT; @@ -555,8 +557,8 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) for (; OPT_ISSET(ops,'f') || *args; args++) { char outbuf[PATH_MAX + 9]; /* "link " + link name + NULL */ int rval = OPT_ISSET(ops,'f') ? fstat(fd, &statbuf) : - OPT_ISSET(ops,'L') ? lstat(unmeta(*args), &statbuf) : - stat(unmeta(*args), &statbuf); + OPT_ISSET(ops,'L') ? lstat(*args, &statbuf) : + stat(*args, &statbuf); if (rval) { if (OPT_ISSET(ops,'f')) sprintf(outbuf, "%d", fd); @@ -571,10 +573,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (flags & STF_FILE) { if (arrnam) - *arrptr++ = ztrdup(*args); + *arrptr++ = ztrdup_metafy(*args); else if (hashnam) { *hashptr++ = ztrdup(HNAMEKEY); - *hashptr++ = ztrdup(*args); + *hashptr++ = ztrdup_metafy(*args); } else printf("%s%s", *args, (flags & STF_PICK) ? " " : ":\n"); }
Bart Schaefer wrote on Sat, 30 Apr 2022 05:33 +00:00:
> On Fri, Apr 29, 2022 at 9:54 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>>
>> Thanks. Now it works by itself but not when preceded by é:
>
> Typo, sorry.
Confirmed in my original test case, and I see you've pushed this too. Thanks.
Daniel