From: Mikael Magnusson <mikachu@gmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: mkdir builtin and $'\0'
Date: Fri, 21 Aug 2015 08:20:55 +0200 [thread overview]
Message-ID: <CAHYJk3QXp-Ege9z4KDvKJSpahNTezSBnpTw0LEs1=BXrMis=UA@mail.gmail.com> (raw)
In-Reply-To: <20150818173726.02ef5782@pwslap01u.europe.root.pri>
On Tue, Aug 18, 2015 at 6:37 PM, Peter Stephenson
<p.stephenson@samsung.com> wrote:
> On Tue, 18 Aug 2015 17:20:40 +0100
> Stephane Chazelas <stephane.chazelas@gmail.com> 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
next prev parent reply other threads:[~2015-08-21 6:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 9:19 Stephane Chazelas
2015-08-18 9:49 ` Peter Stephenson
2015-08-18 11:11 ` Stephane Chazelas
2015-08-18 11:27 ` Peter Stephenson
2015-08-18 12:55 ` Stephane Chazelas
2015-08-18 13:24 ` Peter Stephenson
2015-08-18 14:21 ` Peter Stephenson
2015-08-18 15:07 ` Peter Stephenson
2015-08-18 15:18 ` Peter Stephenson
2015-08-18 15:19 ` Mikael Magnusson
2015-08-19 9:52 ` Peter Stephenson
2015-08-19 13:10 ` Stephane Chazelas
2015-08-18 11:06 ` Peter Stephenson
2015-08-18 16:20 ` Stephane Chazelas
2015-08-18 16:37 ` Peter Stephenson
2015-08-21 6:20 ` Mikael Magnusson [this message]
2015-08-21 8:57 ` Peter Stephenson
2015-08-21 14:09 ` Peter Stephenson
2015-08-20 11:15 Recommend latex surgical gloves ED
2015-08-20 16:42 ` 5.0.9 / 5.1 agani (ws Re: Recommend latex surgical gloves) Peter Stephenson
2015-08-21 3:38 ` Mikael Magnusson
2015-09-04 13:44 ` mkdir builtin and $'\0' Oliver Kiddle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHYJk3QXp-Ege9z4KDvKJSpahNTezSBnpTw0LEs1=BXrMis=UA@mail.gmail.com' \
--to=mikachu@gmail.com \
--cc=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).