zsh-workers
 help / color / mirror / code / Atom feed
* dir/*<tab> expansion doesn't work with directories with apostrophe in the name
@ 2014-01-18  0:53 Axel Beckert
  2014-01-18  2:20 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Beckert @ 2014-01-18  0:53 UTC (permalink / raw)
  To: zsh-workers

Hi,

this is a forward of https://bugs.launchpad.net/bugs/687461 -- not a
segfault, but easy to reproduce:

--->8---
When the directory contains a single quote (apostrophe) in its name,
pressing the tab key to expand dir/* into a list of files no longer
works. What happens instead is that the tab key doesn't do anything
while cursor is inside the dir/* word.

This worked as expected in previous versions of zsh. In zsh 4.3.10
(specifically 4.3.10-14ubuntu1, Ubuntu maverick) it works for
directories without apostrophes in the name. I discovered it while
trying to choose mp3s to queue in a music player, with the mp3s
residing in a directory with apostrophe in the name.

Here is a recipe to repeat the bug:

$ zsh -f
mulj% mkdir "a'b"
mulj% touch "a'b"/{1,2,3}
mulj% ls a\'b/* # press TAB with cursor immediately after the *, nothing happens
# pressing enter correctly executes the (expanded) command:
a'b/1 a'b/2 a'b/3
mulj% mv a\'b ab
mulj% ls ab/* # now pressing TAB with cursor immediately after the * correctly
              # expands ab/* to ab/1 ab/2 ab/3
mulj% ls ab/1 ab/2 ab/3
---8<---

I can reproduce this in zsh 5.0.5 as currently in Debian
Testing/Unstable.

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe@deuxchevaux.org  (Mail)
 X   See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dir/*<tab> expansion doesn't work with directories with apostrophe in the name
  2014-01-18  0:53 dir/*<tab> expansion doesn't work with directories with apostrophe in the name Axel Beckert
@ 2014-01-18  2:20 ` Bart Schaefer
  2014-01-18  9:57   ` Axel Beckert
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2014-01-18  2:20 UTC (permalink / raw)
  To: zsh-workers

On Jan 18,  1:53am, Axel Beckert wrote:
}
} When the directory contains a single quote (apostrophe) in its name,
} pressing the tab key to expand dir/* into a list of files no longer
} works. What happens instead is that the tab key doesn't do anything
} while cursor is inside the dir/* word.

This is the behavior for me as far back as zsh-4.2.0 when starting from
zsh -f.  It's probably related to changing expand-word to use the same
internal routines as completion, which happened somewhere during 4.1.x
development.

Some discussion of this can be found in the threads leading up to
users/18243 and subsequently workers/32186 ...

The _expand completer and _expand_word widget via compinit appear to
handle these quote marks correctly, as of 5.0.5.  It's only the default
internal expand-word / expand-or-complete that still get stuck.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dir/*<tab> expansion doesn't work with directories with apostrophe in the name
  2014-01-18  2:20 ` Bart Schaefer
@ 2014-01-18  9:57   ` Axel Beckert
  2014-01-18 10:08     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Beckert @ 2014-01-18  9:57 UTC (permalink / raw)
  To: zsh-workers

Hi Bart,

On Fri, Jan 17, 2014 at 06:20:29PM -0800, Bart Schaefer wrote:
> On Jan 18,  1:53am, Axel Beckert wrote:
> } When the directory contains a single quote (apostrophe) in its name,
> } pressing the tab key to expand dir/* into a list of files no longer
> } works. What happens instead is that the tab key doesn't do anything
> } while cursor is inside the dir/* word.
> 
> This is the behavior for me as far back as zsh-4.2.0 when starting from
> zsh -f.  It's probably related to changing expand-word to use the same
> internal routines as completion, which happened somewhere during 4.1.x
> development.
> 
> Some discussion of this can be found in the threads leading up to
> users/18243 and subsequently workers/32186 ...
> 
> The _expand completer and _expand_word widget via compinit appear to
> handle these quote marks correctly, as of 5.0.5.

Not sure if I got it right, but I think I can also reproduce it with
compinit:

/tmp/zsh-test → zsh -f
kiva6% autoload -Uz compinit
kiva6% compinit
kiva6% ls -l
total 8
drwxr-xr-x 2 abe abe 4096 Jan 18 01:44 a'b
drwxr-xr-x 2 abe abe 4096 Jan 18 01:44 dc
kiva6% ls -l "a'b"
total 0
-rw-r--r-- 1 abe abe 0 Jan 18 01:44 1
-rw-r--r-- 1 abe abe 0 Jan 18 01:44 2
-rw-r--r-- 1 abe abe 0 Jan 18 01:44 3
kiva6% ls -l dc
total 0
-rw-r--r-- 1 abe abe 0 Jan 18 01:44 1
-rw-r--r-- 1 abe abe 0 Jan 18 01:44 2
-rw-r--r-- 1 abe abe 0 Jan 18 01:44 3
kiva6% ls a\'b/*<Tab>
(Does not work, rings the bell.)
kiva6% ls dc/*<Tab>
(Does work, expands to the following.)
kiva6% ls dc/1 dc/2 dc/3 

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe@deuxchevaux.org  (Mail)
 X   See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dir/*<tab> expansion doesn't work with directories with apostrophe in the name
  2014-01-18  9:57   ` Axel Beckert
@ 2014-01-18 10:08     ` Bart Schaefer
  2014-01-18 10:15       ` Axel Beckert
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2014-01-18 10:08 UTC (permalink / raw)
  To: zsh-workers

On Jan 18, 10:57am, Axel Beckert wrote:
} Subject: Re: dir/*<tab> expansion doesn't work with directories with apost
}
} On Fri, Jan 17, 2014 at 06:20:29PM -0800, Bart Schaefer wrote:
} > The _expand completer and _expand_word widget via compinit appear to
} > handle these quote marks correctly, as of 5.0.5.
} 
} Not sure if I got it right, but I think I can also reproduce it with
} compinit:
} 
} /tmp/zsh-test -> zsh -f
} kiva6% autoload -Uz compinit
} kiva6% compinit
} kiva6% ls a\'b/*<Tab>
} (Does not work, rings the bell.)

You need to try <ctrl+x e> instead of <tab> here, or add something like

    zstyle ':completion:*' completer _expand _complete _ignored

otherwise you're still using the built-in expand-word underneath.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dir/*<tab> expansion doesn't work with directories with apostrophe in the name
  2014-01-18 10:08     ` Bart Schaefer
@ 2014-01-18 10:15       ` Axel Beckert
  0 siblings, 0 replies; 5+ messages in thread
From: Axel Beckert @ 2014-01-18 10:15 UTC (permalink / raw)
  To: zsh-workers

Hi Bart,

On Sat, Jan 18, 2014 at 02:08:29AM -0800, Bart Schaefer wrote:
> On Jan 18, 10:57am, Axel Beckert wrote:
> } Subject: Re: dir/*<tab> expansion doesn't work with directories with apost
> } On Fri, Jan 17, 2014 at 06:20:29PM -0800, Bart Schaefer wrote:
> } > The _expand completer and _expand_word widget via compinit appear to
> } > handle these quote marks correctly, as of 5.0.5.
> } 
> } Not sure if I got it right, but I think I can also reproduce it with
> } compinit:
> } 
> } /tmp/zsh-test -> zsh -f
> } kiva6% autoload -Uz compinit
> } kiva6% compinit
> } kiva6% ls a\'b/*<Tab>
> } (Does not work, rings the bell.)
> 
> You need to try <ctrl+x e> instead of <tab> here, or add something like
> 
>     zstyle ':completion:*' completer _expand _complete _ignored
> 
> otherwise you're still using the built-in expand-word underneath.

Thanks for these hints! Will forward them to the bug reporter.

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe@deuxchevaux.org  (Mail)
 X   See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-18 10:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-18  0:53 dir/*<tab> expansion doesn't work with directories with apostrophe in the name Axel Beckert
2014-01-18  2:20 ` Bart Schaefer
2014-01-18  9:57   ` Axel Beckert
2014-01-18 10:08     ` Bart Schaefer
2014-01-18 10:15       ` Axel Beckert

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).