mirror of
https://github.com/zsh-users/zsh
synced 2024-07-21 10:14:19 +00:00
36262: Replace fix for missing unmeta in chdir().
It was needed in the argument to one of a pair of lchdir()s rather than within zchdir(). Add tests for the case of a character with 0x83 within it.
This commit is contained in:
parent
364e1717f0
commit
61afb8dc8d
|
@ -1,5 +1,9 @@
|
|||
2015-08-21 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 36262: Src/builin.c, Src/compat.c, Src/utils.c,
|
||||
Test/D07multibyte.ztst: replace 36232: the unmeta()
|
||||
was needed at a place higher up. Add test.
|
||||
|
||||
* 36250, tweaked: README, NEWS: highlight bracketed paste mode;
|
||||
next version will be 5.1 rather than 5.0.9.
|
||||
|
||||
|
|
|
@ -1163,7 +1163,7 @@ cd_try_chdir(char *pfix, char *dest, int hard)
|
|||
* or a parent directory is renamed in the interim.
|
||||
*/
|
||||
if (lchdir(buf, NULL, hard) &&
|
||||
(pfix || *dest == '/' || lchdir(dest, NULL, hard))) {
|
||||
(pfix || *dest == '/' || lchdir(unmeta(dest), NULL, hard))) {
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
|
11
Src/compat.c
11
Src/compat.c
|
@ -454,8 +454,13 @@ zgetcwd(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* chdir with arbitrary long pathname. Returns 0 on success, -1 on normal *
|
||||
* failure and -2 when chdir failed and the current directory is lost. */
|
||||
/*
|
||||
* chdir with arbitrary long pathname. Returns 0 on success, -1 on normal *
|
||||
* failure and -2 when chdir failed and the current directory is lost.
|
||||
*
|
||||
* This is to be treated as if at system level, so dir is unmetafied but
|
||||
* terminated by a NULL.
|
||||
*/
|
||||
|
||||
/**/
|
||||
mod_export int
|
||||
|
@ -465,7 +470,7 @@ zchdir(char *dir)
|
|||
int currdir = -2;
|
||||
|
||||
for (;;) {
|
||||
if (!*dir || chdir(unmeta(dir)) == 0) {
|
||||
if (!*dir || chdir(dir) == 0) {
|
||||
#ifdef HAVE_FCHDIR
|
||||
if (currdir >= 0)
|
||||
close(currdir);
|
||||
|
|
13
Src/utils.c
13
Src/utils.c
|
@ -6440,10 +6440,15 @@ init_dirsav(Dirsav d)
|
|||
d->dirfd = d->level = -1;
|
||||
}
|
||||
|
||||
/* Change directory, without following symlinks. Returns 0 on success, -1 *
|
||||
* on failure. Sets errno to ENOTDIR if any symlinks are encountered. If *
|
||||
* fchdir() fails, or the current directory is unreadable, we might end up *
|
||||
* in an unwanted directory in case of failure. */
|
||||
/*
|
||||
* Change directory, without following symlinks. Returns 0 on success, -1
|
||||
* on failure. Sets errno to ENOTDIR if any symlinks are encountered. If
|
||||
* fchdir() fails, or the current directory is unreadable, we might end up
|
||||
* in an unwanted directory in case of failure.
|
||||
*
|
||||
* path is an unmetafied but null-terminated string, as needed by system
|
||||
* calls.
|
||||
*/
|
||||
|
||||
/**/
|
||||
mod_export int
|
||||
|
|
|
@ -496,3 +496,15 @@
|
|||
>OK
|
||||
>OK
|
||||
>OK
|
||||
|
||||
() {
|
||||
emulate -L zsh
|
||||
setopt errreturn
|
||||
local cdpath=(.)
|
||||
mkdir ホ
|
||||
cd ホ
|
||||
cd ..
|
||||
cd ./ホ
|
||||
cd ..
|
||||
}
|
||||
0:cd with special characters
|
||||
|
|
Loading…
Reference in a new issue