zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: zstat output of Unicode filenames
Date: Fri, 29 Apr 2022 21:22:41 -0700	[thread overview]
Message-ID: <CAH+w=7bjVaMULf7_jXjtZRmBO9zAvLCkmy=3bp8DWOEUE+jVgA@mail.gmail.com> (raw)
In-Reply-To: <20220430004132.GA7718@tarpaulin.shahaf.local2>

[-- 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");
 	}

  reply	other threads:[~2022-04-30  4:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-30  0:41 Daniel Shahaf
2022-04-30  4:22 ` Bart Schaefer [this message]
2022-04-30  4:53   ` Daniel Shahaf
2022-04-30  5:33     ` Bart Schaefer
2022-05-01 14:46       ` Daniel Shahaf

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=7bjVaMULf7_jXjtZRmBO9zAvLCkmy=3bp8DWOEUE+jVgA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=d.s@daniel.shahaf.name \
    --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).