Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zstat output of Unicode filenames
- X-seq: zsh-workers 50147
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: zstat output of Unicode filenames
- Date: Fri, 29 Apr 2022 21:22:41 -0700
- Archived-at: <https://zsh.org/workers/50147>
- In-reply-to: <20220430004132.GA7718@tarpaulin.shahaf.local2>
- List-id: <zsh-workers.zsh.org>
- References: <20220430004132.GA7718@tarpaulin.shahaf.local2>
On Fri, Apr 29, 2022 at 5:42 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Looks like a missing unmetafy()?
Try this?
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");
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author