From: Andrey Borzenkov <arvidjaar@newmail.ru>
To: zsh-workers@sunsite.dk
Subject: Re: mb_metacharlenconv vs. tokens
Date: Wed, 27 Sep 2006 20:31:35 +0400 [thread overview]
Message-ID: <200609272031.35901.arvidjaar@newmail.ru> (raw)
In-Reply-To: <200609261810.k8QIAJ7a003189@news01.csr.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 26 September 2006 22:10, Peter Stephenson wrote:
> Andrey Borzenkov wrote:
> > Then this is very basic bug, because as simple as running function from
> > V01 test results in:
> >
> > Breakpoint 2, mb_metacharlenconv (
> >
> > s=0xb7c41951 "\215\210M\211\205\215\210f\211\231\212\210zmodload
> > -d\211\231\2 16:
> > \204\207:\207 \205m\210 \207\214\211\216", wcp=0xbfd4ef88)
> >
> > which corresponds to the line in zmodunload:
> >
> > if [[ -z ${(M)${(f)"$(zmodload -d)"}:#*:* $m( *|)} ]]
> >
> > > It should have been
> > > untokenized at some point in the sequence leading to the call,
> >
> > #2 0x080bd2a4 in paramsubst (l=0xbfd4f7ac, n=0xbfd4f7a0, str=0xbfd4f388,
> > qt=0, ssub=4) at /home/bor/src/zsh/Src/subst.c:1499
>
> The problem is probably here (or around here... there's been some
> recursive jiggery pokery).
This is one seems pretty much top level.
> We should untokenize a nested
> substitution before trying to do anything with it, and only tokenize it
> later if the effect of GLOB_SUBST is present. This is roughly where I
> saw the problem before.
I am not sure if this is really possible (or feasible). While paramsubst case
is trivially solved (worked around actually) by
Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.63
diff -u -p -r1.63 subst.c
- --- Src/subst.c 23 Sep 2006 20:25:06 -0000 1.63
+++ Src/subst.c 27 Sep 2006 16:23:41 -0000
@@ -1496,12 +1496,13 @@ paramsubst(LinkList l, LinkNode n, char
* these later on, too.
*/
c = *s;
- - if (itype_end(s, IIDENT, 1) == s && *s != '#' && c != Pound &&
+ if (*s != '#' && c != Pound &&
c != '-' && c != '!' && c != '$' && c != String && c != Qstring &&
c != '?' && c != Quest &&
c != '*' && c != Star && c != '@' && c != '{' &&
c != Inbrace && c != '=' && c != Equals && c != Hat &&
- - c != '^' && c != '~' && c != Tilde && c != '+') {
+ c != '^' && c != '~' && c != Tilde && c != '+' &&
+ (itok(c) || itype_end(s, IIDENT, 1) == s)) {
s[-1] = '$';
*str = s;
return n;
fetchvalue() case is not; and in fetchvalue() we explicitly look for tokenized
string.
I am afraid that mb_metastrlenconv is rather overloaded. As it looks like
traversing string character by character is valid operation for input as
well, so we cannot exclude tokens there.
Let's put it differently - what we intend is to avoid passing bogus character
to mbrtowc(). If we *know* the context is tokenized we could just as well
pass a flag to itype_end() and mb_metacharlenconv() so they will check for
tokens and skip them. Does it actually make sense?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFFGqdnR6LMutpd94wRAvpwAKCfhCFzK6FdvNnvSGHkDx8rx2PjnQCcDaZp
ThXNuFDZQcgDGLknXoAY5jE=
=fLqH
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2006-09-27 16:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-25 17:45 Andrey Borzenkov
2006-09-26 9:20 ` Peter Stephenson
2006-09-26 18:03 ` Andrey Borzenkov
2006-09-26 18:10 ` Peter Stephenson
2006-09-27 16:31 ` Andrey Borzenkov [this message]
2006-09-27 16:51 ` Peter Stephenson
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=200609272031.35901.arvidjaar@newmail.ru \
--to=arvidjaar@newmail.ru \
--cc=zsh-workers@sunsite.dk \
/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).