* Expansion bug with braces and spaces
@ 2011-04-07 18:44 Benjamin R. Haskell
2011-04-07 18:59 ` Mikael Magnusson
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin R. Haskell @ 2011-04-07 18:44 UTC (permalink / raw)
To: Zsh Workers
There seems to be some issue with expansion of brace alternatives when
there's a space in the filename. First noticed when I had a bunch of
poorly named downloads:
$ ls -1 Download/bug\ \(*
Download/bug (1).patch
Download/bug (2).patch
...etc...
Download/bug (17).patch
Download/bug (18).patch
And I wanted to see the differences between two of them:
$ diff -ur Download/bug\ \({1<Tab>
$ diff -ur Download/bug\ {\(1
(hitting tab again made it worse)
$ diff -ur Download/bug\ {\(1<Tab>
$ diff -ur Download/bug\{ \(1
(but not again, since the file no longer exists)
$ diff -ur Download/bug\{ \(1<Tab>
A more minimal example:
$ bindkey "^I" expand-or-complete
$ mkdir /tmp/brace-bug
$ touch /tmp/brace-bug/file\ {abcd,abce}
# this one's weird, but still okay:
$ print -l /tmp/brace-bug/file\ ab{<Tab>
$ print -l /tmp/brace-bug/file\ a{bc
# this one's not okay, since it's now quoting the brace:
$ print -l /tmp/brace-bug/file\ {a<Tab>
$ print -l /tmp/brace-bug/file\{ abc
--
Best,
Ben
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Expansion bug with braces and spaces
2011-04-07 18:44 Expansion bug with braces and spaces Benjamin R. Haskell
@ 2011-04-07 18:59 ` Mikael Magnusson
2011-04-08 8:44 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2011-04-07 18:59 UTC (permalink / raw)
To: Zsh Workers
On 7 April 2011 20:44, Benjamin R. Haskell <zsh@benizi.com> wrote:
> There seems to be some issue with expansion of brace alternatives when
> there's a space in the filename. First noticed when I had a bunch of poorly
> named downloads:
>
> $ ls -1 Download/bug\ \(*
> Download/bug (1).patch
> Download/bug (2).patch
> ...etc...
> Download/bug (17).patch
> Download/bug (18).patch
>
> And I wanted to see the differences between two of them:
> $ diff -ur Download/bug\ \({1<Tab>
> $ diff -ur Download/bug\ {\(1
>
> (hitting tab again made it worse)
> $ diff -ur Download/bug\ {\(1<Tab>
> $ diff -ur Download/bug\{ \(1
>
> (but not again, since the file no longer exists)
> $ diff -ur Download/bug\{ \(1<Tab>
>
>
> A more minimal example:
>
> $ bindkey "^I" expand-or-complete
>
> $ mkdir /tmp/brace-bug
> $ touch /tmp/brace-bug/file\ {abcd,abce}
>
> # this one's weird, but still okay:
> $ print -l /tmp/brace-bug/file\ ab{<Tab>
> $ print -l /tmp/brace-bug/file\ a{bc
>
> # this one's not okay, since it's now quoting the brace:
> $ print -l /tmp/brace-bug/file\ {a<Tab>
> $ print -l /tmp/brace-bug/file\{ abc
It's at least not a new issue, I reported it back in 2006 but was
never able to produce a minimal testcase starting from zsh -f. And by
able I mean it never annoyed me enough :).
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Expansion bug with braces and spaces
2011-04-07 18:59 ` Mikael Magnusson
@ 2011-04-08 8:44 ` Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2011-04-08 8:44 UTC (permalink / raw)
To: Zsh Workers
On Thu, 7 Apr 2011 20:59:58 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:
> On 7 April 2011 20:44, Benjamin R. Haskell <zsh@benizi.com> wrote:
> > There seems to be some issue with expansion of brace alternatives
> > when there's a space in the filename. First noticed when I had a
> > bunch of poorly named downloads:
>
> It's at least not a new issue, I reported it back in 2006 but was
> never able to produce a minimal testcase starting from zsh -f. And by
> able I mean it never annoyed me enough :).
Without looking at it again, I think brace expansion is one of the really
big hacks in the completion code, taking arguments apart and putting
them back together again in an ad hoc fashion, so without being
rewritten from the ground up it might be hard to do much. Having said
that, if anyone was able to understand it it might be easy.
--
Peter Stephenson <pws@csr.com> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-08 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-07 18:44 Expansion bug with braces and spaces Benjamin R. Haskell
2011-04-07 18:59 ` Mikael Magnusson
2011-04-08 8:44 ` Peter Stephenson
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).