Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: mkdir builtin and $'\0'
- X-seq: zsh-workers 36259
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: mkdir builtin and $'\0'
- Date: Fri, 21 Aug 2015 08:20:55 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=VjA2RBo40v51RRgpIiZB9j32DY7vkqUOu2tlfD7QcrE=; b=ng4Rm/6TLpi35IiQ059iDzJGCOzjhsHqstSC4YRBh5zAg9vUQX0kV+TqV6LQ93WyE+ BOn6jZsbUcAuowQ0mGhZK7ALp9qO3XeDFZSEAQMyER/aQs77mcj3J3ipc2Yo2qZHKtXS T8xSooyLJpTk6CRsEEqWYyX3L6u/Fe4wPcPa18j2ZNma1/Bqg/dh+zjeh6JhOTT3/I4X 2gCw8JEf2VyXLME5BmopfsDW+xtwjZGcqMTA7nVEr76Fws9rDohkuXwoUZTeN2grup+H kvDFFmLpNK1/p9uKikO9QIsY8sm8IrM0q44evy5/VnbLk6G1vU31E3SS5U7R/pLKUv2c fMNg==
- In-reply-to: <20150818173726.02ef5782@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20150818091904.GA5389@chaz.gmail.com> <20150818162040.GC5629@chaz.gmail.com> <20150818173726.02ef5782@pwslap01u.europe.root.pri>
On Tue, Aug 18, 2015 at 6:37 PM, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> 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);
[replying to the correct thread]
% mkdir /tmp/ホ
% cd /tmp/ホ
cd: no such file or directory: /tmp/ホ
% cd /tmp
% cd ホ
% pwd
/tmp/ホ
% echo ホ|xxd
00000000: e383 9b0a
> It doesn't happen with all japanese characters. I'm hoping one of
> those bytes in the output mean something to you. I'm also assuming
> this is related to the recent fudging of unmetafy in chdir().
I just checked and
% octtohex 203
0x83
this is the \203 from the chdir strace above, and 83 from the middle
of my character. Do we have inconsistent metafication in this string
somehow?
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author