From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Bug in alias expansion
Date: Wed, 18 Nov 2015 10:30:38 +0000 [thread overview]
Message-ID: <20151118103038.6eab1150@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <151117205508.ZM26027@torch.brasslantern.com>
On Tue, 17 Nov 2015 20:55:08 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> (Of course 37128 and 37122 aren't mutually exclusive, we can apply
> both; there's probably some other case where subscript parsing may
> go wrong that's fixed by 37128.)
37128 is fixing a particular problem to do with assumptions about
parsing that are no longer valid; for this, it is entirely irrelevant
where the alias actually gets expanded. I haven't followed whether
there is a visible bug as a consequence of the latter.
> } It's not very efficient, and it still has the problem that if something
> } funny happens to the length --- and I don't think there's any guarantee
> } of length preservation built into the lexer even though it happens to
> } work in the cases we've looked at so far --- then somebody's going to
> } get hurt.
>
> I'm not following this stuff about the length -- it can't mean that the
> length of the alias expansion is the same as the length of the aliased
> token -- so to what does it refer?
The code assumes that if you pass a string through parse_subscript(), or
more accurately through dquote_parse(), then the sequence of characters
that comes out maps one-to-one onto the sequence of characters that went
in. For example, a ( turns into an Inpar, a " turns into a Dnull, and
so on --- similarly to if you simply tokenised it character by
character but with more context sensitivity. The change makes the
alias expansion irrelevant to this --- we backtrack over that -- but
the code still relies on this assumption. Given how much can now
happen inside dquote_parse() (as we see here, if only as a side issue
to the bug being fixed), this doesn't seem ideal. However, I don't know
of a case where it fails.
pws
prev parent reply other threads:[~2015-11-18 10:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 18:03 Kynn Jones
2015-11-14 1:03 ` Bart Schaefer
2015-11-14 18:57 ` Kynn Jones
2015-11-14 19:03 ` Bart Schaefer
2015-11-14 19:19 ` Kynn Jones
2015-11-14 21:40 ` Bart Schaefer
2015-11-14 22:20 ` Kynn Jones
2015-11-15 20:03 ` Peter Stephenson
2015-11-15 21:52 ` Bart Schaefer
2015-11-15 22:26 ` Bart Schaefer
2015-11-15 22:48 ` Bart Schaefer
2015-11-16 0:50 ` Mikael Magnusson
2015-11-16 3:24 ` Bart Schaefer
2015-11-16 5:42 ` Mikael Magnusson
2015-11-18 10:42 ` Peter Stephenson
2015-11-18 14:13 ` Peter Stephenson
2015-11-18 15:52 ` Bart Schaefer
2015-11-18 16:14 ` Peter Stephenson
2015-11-18 18:09 ` Bart Schaefer
2015-11-17 17:29 ` Peter Stephenson
2015-11-18 4:55 ` Bart Schaefer
2015-11-18 10:30 ` Peter Stephenson [this message]
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=20151118103038.6eab1150@pwslap01u.europe.root.pri \
--to=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).