Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Running 'type' causes false positive hashed command completion
- X-seq: zsh-workers 39104
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Running 'type' causes false positive hashed command completion
- Date: Thu, 25 Aug 2016 09:59:00 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=zp2KKQo7r6roEhVy5XL2wVpGMc4HB0Ra6rOBB+kptBw=; b=uNKivjJYfiUQoQcgq0f/eqNvoSyJBrhkAXDG83Ty5qlSFUM6x8NwwUhF8lf5IoAHnY cWFgoDNqv4Av9v+O2KHGymwL0N5LvFrrBxOs/++fKFYFfTHGdgvck+fV8IxNIQKKRMQY IPp7w5FmBdy7JuoDCuzPUVgGV2fg9UiSGW0TfbohVsZhZ09vzk9aVsL3ZO0DtDjddAsF vHj+B8XHcir0APOvjlctI4/lCAN+2xFLz+OvL1ZbQtTiLWKAXjm3Qur8gcTDqKURaZ6c MI5iNeNlM0swF8MBtNOcwcNwudJe98ZgDDp8aBRUC0YwUYoPcaM6+sNgTKfTe82sTu5Z A+tQ==
- In-reply-to: <20160824205849.GA11450@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160824205849.GA11450@fujitsu.shahaf.local2>
On Aug 24, 8:58pm, Daniel Shahaf wrote:
} Subject: Running 'type' causes false positive hashed command completion
}
} $ zsh -f
} % cd $(mtemp -d)
} % touch sudofoo; chmod +x $_
} % ./sudo<TAB>
} <becomes>
} % ./sudofoo <^C>
} % type -w ./sudo
} ./sudo: none
} % ./sudo<TAB>
} ./sudo sudofoo*
}
} That's wrong because ./sudo does not exist.
This seems pretty obvious:
diff --git a/Src/exec.c b/Src/exec.c
index ea9214d..9b24d38 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -772,7 +772,7 @@ findcmd(char *arg0, int docopy)
Cmdnam cn;
cn = (Cmdnam) cmdnamtab->getnode(cmdnamtab, arg0);
- if (!cn && isset(HASHCMDS))
+ if (!cn && isset(HASHCMDS) && !isrelative(arg0))
cn = hashcmd(arg0, path);
if ((int) strlen(arg0) > PATH_MAX)
return NULL;
Can anyone think of a valid case which that breaks? The doc (under the
PATH_DIRS option) even says "Commands explicitly beginning with `/', `./'
or `../' are not subject to the path search."
Messages sorted by:
Reverse Date,
Date,
Thread,
Author