Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] hist, subst: add :R modifier for readlink(2)
- X-seq: zsh-workers 54306
- From: dana <dana@xxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] hist, subst: add :R modifier for readlink(2)
- Date: Mon, 06 Apr 2026 20:23:00 -0500
- Archived-at: <https://zsh.org/workers/54306>
- Feedback-id: i9be146f9:Fastmail
- In-reply-to: <CAH+w=7Yn7uMK_y0GWV87k=NBZVf8yJ5fAA9V3c=FybaypYUpDA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <463953a5-c556-4078-811b-e42838eaf422@app.fastmail.com> <CAH+w=7Yn7uMK_y0GWV87k=NBZVf8yJ5fAA9V3c=FybaypYUpDA@mail.gmail.com>
On Mon 6 Apr 2026, at 17:41, Bart Schaefer wrote:
> Is it really OK for this to fail when not HAVE_READLINK ?
>
> That is, to print an error, as opposed to act like :P would.
i didn't think about that. you're just suggesting the change below
right?
your reply + something mikael said on irc have me second-guessing the
whole thing, though, because now i'm not sure there's an obviously /
generically correct thing to do when it can't resolve
returning the input makes sense for :[aAP] because those are meant to
produce a usable path (or at least one that's as usable as the input),
and that operation is inherently transformative. but here the point is
to get the link target *verbatim*. having it substitute the input when
that's not possible seems weird/annoying for many use cases
it could return an empty string instead, like `zstat +link` does, but
that's weird in its own way, especially for globquals
unless someone else thinks it's an especially great idea i'll probably
just leave it alone after all
dana
diff --git a/Src/hist.c b/Src/hist.c
index 5f528ec78..1a9c0306d 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1893,6 +1893,10 @@ chreadlink(char **junkptr)
ssize_t len;
char buf[PATH_MAX];
+#ifndef HAVE_READLINK
+ return 1;
+#endif
+
if (!**junkptr)
return 1;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author