summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2026-05-26 19:30:47 +0200
committerMikael Magnusson <mikachu@gmail.com>2026-06-04 05:46:09 +0200
commitd092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a (patch)
treeb20ffe3ba67cd061c318342aa27edfed5d91cc59
parent54617: fix lookup in $commands array when hashlistall is unset (diff)
downloadzsh-d092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a.tar
zsh-d092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a.tar.gz
zsh-d092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a.tar.bz2
zsh-d092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a.tar.lz
zsh-d092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a.tar.xz
zsh-d092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a.tar.zst
zsh-d092cf6f18f9ba15e9709ed11aafd7e13cf7ae7a.zip
54620: fix check for when to hash commands
-rw-r--r--ChangeLog2
-rw-r--r--Src/exec.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 105dd0a6c..bb18f26ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2026-06-04 Mikael Magnusson <mikachu@gmail.com>
+ * 54620: Src/exec.c: fix check for when to hash commands
+
* 54617: Src/Modules/parameter.c, Src/zsh.h,
Test/V06parameter.ztst: fix lookup in $commands array when
hashlistall is unset
diff --git a/Src/exec.c b/Src/exec.c
index c71cd3614..c1393a384 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -933,7 +933,7 @@ findcmd(char *arg0, int docopy, int default_path)
return NULL;
}
cn = (Cmdnam) cmdnamtab->getnode(cmdnamtab, arg0);
- if (!cn && isset(HASHCMDS) && !isrelative(arg0))
+ if (!cn && isset(HASHCMDS))
cn = hashcmd(arg0, path);
if ((int) ztrlen(arg0) >= PATH_MAX)
return NULL;
@@ -1051,7 +1051,7 @@ hashcmd(char *arg0, char **pp)
char *s, buf[MAXCMDLEN];
char **pq;
- if (*arg0 == '/')
+ if ((*arg0 == '/') || !strncmp(arg0, "./", 2) || !strncmp(arg0, "../", 3))
return NULL;
for (; *pp; pp++)
if (**pp == '/') {