1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-12-29 16:25:35 +01:00

39915: whence: Honor PATH_DIRS option for arguments that start with './' or '../'.

While here, add some docstrings.
This commit is contained in:
Daniel Shahaf 2016-11-11 02:25:21 +00:00
parent 0a6098a1d4
commit c392e6c620
3 changed files with 25 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2016-11-17 Daniel Shahaf <d.s@daniel.shahaf.name>
* 39915: Src/exec.c, Test/E01options.ztst: whence: Honor
PATH_DIRS option for arguments that start with './' or '../'.
2016-11-17 Oliver Kiddle <opk@zsh.org>
* 39962: Src/Zle/zle_keymap.c: bind vi case conversion widgets

View file

@ -806,14 +806,13 @@ findcmd(char *arg0, int docopy, int default_path)
cn = hashcmd(arg0, path);
if ((int) strlen(arg0) > PATH_MAX)
return NULL;
for (s = arg0; *s; s++)
if (*s == '/') {
RET_IF_COM(arg0);
if (arg0 == s || unset(PATHDIRS)) {
return NULL;
}
break;
if ((s = strchr(arg0, '/'))) {
RET_IF_COM(arg0);
if (arg0 == s || unset(PATHDIRS) || !strncmp(arg0, "./", 2) ||
!strncmp(arg0, "../", 3)) {
return NULL;
}
}
if (cn) {
char nn[PATH_MAX];
@ -848,6 +847,11 @@ findcmd(char *arg0, int docopy, int default_path)
return NULL;
}
/*
* Return TRUE if the given path denotes an executable regular file, or a
* symlink to one.
*/
/**/
int
iscom(char *s)
@ -877,6 +881,11 @@ isreallycom(Cmdnam cn)
return iscom(fullnam);
}
/*
* Return TRUE if the given path contains a dot or dot-dot component
* and does not start with a slash.
*/
/**/
int
isrelative(char *s)

View file

@ -784,6 +784,10 @@
>unsetting option...
?(eval):14: no such file or directory: pathtestdir/findme
(setopt pathdirs; path+=( /usr/bin ); type ./env)
1:whence honours PATH_DIRS option
>./env not found
setopt posixbuiltins
PATH= command -v print
PATH= command -V print