diff options
| author | Barton E. Schaefer <schaefer@zsh.org> | 2017-03-11 14:39:17 -0800 |
|---|---|---|
| committer | Barton E. Schaefer <schaefer@zsh.org> | 2017-03-11 14:40:12 -0800 |
| commit | 420fc41b7cccab7f1ee07abab2cb7c72501cf91e (patch) | |
| tree | 252077047003913b490cbaf253c34cc74fce8a59 | |
| parent | unposted (github pull request #15): fix a small typo in `ip` corrections file (diff) | |
| download | zsh-420fc41b7cccab7f1ee07abab2cb7c72501cf91e.tar zsh-420fc41b7cccab7f1ee07abab2cb7c72501cf91e.tar.gz zsh-420fc41b7cccab7f1ee07abab2cb7c72501cf91e.tar.bz2 zsh-420fc41b7cccab7f1ee07abab2cb7c72501cf91e.tar.lz zsh-420fc41b7cccab7f1ee07abab2cb7c72501cf91e.tar.xz zsh-420fc41b7cccab7f1ee07abab2cb7c72501cf91e.tar.zst zsh-420fc41b7cccab7f1ee07abab2cb7c72501cf91e.zip | |
40832: fix $x:P when PWD=/
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | Src/subst.c | 12 |
2 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,7 @@ +2017-03-11 Barton E. Schaefer <schaefer@zsh.org> + + * 40832: Src/subst.c: fix $x:P when PWD=/ + 2017-03-11 John Leuenhagen <john@zlima12.com> * unposted (github pull request #15): diff --git a/Src/subst.c b/Src/subst.c index 2214b3d4f..e639c96a8 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -4336,7 +4336,11 @@ modify(char **str, char **ptr) break; case 'P': if (*copy != '/') { - copy = zhtricat(metafy(zgetcwd(), -1, META_HEAPDUP), "/", copy); + char *here = zgetcwd(); + if (here[strlen(here)-1] != '/') + copy = zhtricat(metafy(here, -1, META_HEAPDUP), "/", copy); + else + copy = dyncat(here, copy); } copy = xsymlink(copy, 1); break; @@ -4418,7 +4422,11 @@ modify(char **str, char **ptr) break; case 'P': if (**str != '/') { - *str = zhtricat(metafy(zgetcwd(), -1, META_HEAPDUP), "/", *str); + char *here = zgetcwd(); + if (here[strlen(here)-1] != '/') + *str = zhtricat(metafy(here, -1, META_HEAPDUP), "/", *str); + else + *str = dyncat(here, *str); } *str = xsymlink(*str, 1); break; |
