diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-10-30 15:34:18 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-10-30 15:34:18 +0000 |
commit | 25833cc89eef879857100d321c2140ff13f63886 (patch) | |
tree | 3a7c1d97cd0d1c01238aaac8b185e9894e31b028 | |
parent | 176e0dc8217d97be260bdb8f38e7bd5ddeecdf95 (diff) | |
download | zsh-25833cc89eef879857100d321c2140ff13f63886.tar.gz zsh-25833cc89eef879857100d321c2140ff13f63886.tar.xz zsh-25833cc89eef879857100d321c2140ff13f63886.zip |
25969: two bugs with metafication plus a test for one
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/subst.c | 8 | ||||
-rw-r--r-- | Src/utils.c | 6 | ||||
-rw-r--r-- | Test/D07multibyte.ztst | 7 |
4 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index 2e7463eca..c66177981 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-10-30 Peter Stephenson <pws@csr.com> + * 25969: Src/subst.c, Src/utils.c, Test/D07multibyte.ztst: + bugs in metafication with prompt expansion called from parameter + expansion and with zsh_directory_name when called from finddir(). + * 25963: Src/utils.c: Interrupt at spell check prompt output garbage. diff --git a/Src/subst.c b/Src/subst.c index df60a27ab..d76215838 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -2738,8 +2738,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) char *tmps; unmetafy(*ap, &len); untokenize(*ap); - tmps = unmetafy(promptexpand(metafy(*ap, len, META_NOALLOC), - 0, NULL, NULL, NULL), &len); + tmps = promptexpand(metafy(*ap, len, META_NOALLOC), + 0, NULL, NULL, NULL); *ap = dupstring(tmps); free(tmps); } @@ -2749,8 +2749,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) val = dupstring(val), copied = 1; unmetafy(val, &len); untokenize(val); - tmps = unmetafy(promptexpand(metafy(val, len, META_NOALLOC), - 0, NULL, NULL, NULL), &len); + tmps = promptexpand(metafy(val, len, META_NOALLOC), + 0, NULL, NULL, NULL); val = dupstring(tmps); free(tmps); } diff --git a/Src/utils.c b/Src/utils.c index 1dd8c3577..550f7bfa7 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -857,7 +857,9 @@ finddir(char *s) scanhashtable(nameddirtab, 0, 0, 0, finddir_scan, 0); if (func) { - char **ares = subst_string_by_func(func, "d", finddir_full); + char *dir_meta = metafy(finddir_full, strlen(finddir_full), + META_ALLOC); + char **ares = subst_string_by_func(func, "d", dir_meta); int len; if (ares && arrlen(ares) >= 2 && (len = (int)zstrtol(ares[1], NULL, 10)) > finddir_best) { @@ -868,6 +870,8 @@ finddir(char *s) finddir_last->diff = len - strlen(finddir_last->node.nam); finddir_best = len; } + if (dir_meta != finddir_full) + zsfree(dir_meta); } return finddir_last; diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst index f8b00fb88..1d440ee30 100644 --- a/Test/D07multibyte.ztst +++ b/Test/D07multibyte.ztst @@ -403,3 +403,10 @@ 0:Backslashes and metafied characters in patterns >Matched against glob/()Ą/* >Matched against glob/()Ā/* + + mkdir 梶浦由記 'Пётр Ильич Чайковский' + (cd 梶浦由記; print ${${(%):-%~}:t}) + (cd 'Пётр Ильич Чайковский'; print ${${(%):-%~}:t}) +0:Metafied characters in prompt expansion +>梶浦由記 +>Пётр Ильич Чайковский |