Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: mkdir builtin and $'\0'
On Tue, 18 Aug 2015 17:20:40 +0100
Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> 2015-08-18 10:19:04 +0100, Stephane Chazelas:
> [...]
> > A bit worse:
> >
> > $ strace -e chdir zsh -c "cd $'a\0b'; print -r -- \$PWD; pwd"
> > chdir("/export/home/stephane/a") = -1 ENOENT (No such file or directory)
> > chdir("a\203 b") = 0
Looks like that's this one (igroning for now the silent use of embedded
nulls).
diff --git a/Src/compat.c b/Src/compat.c
index b3a8b06..a0ce182 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -465,7 +465,7 @@ zchdir(char *dir)
int currdir = -2;
for (;;) {
- if (!*dir || chdir(dir) == 0) {
+ if (!*dir || chdir(unmeta(dir)) == 0) {
#ifdef HAVE_FCHDIR
if (currdir >= 0)
close(currdir);
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author