BTS

Issue983

Title zsh freezing on tab completion (ls)
Priority bug Status resolved
Superseder Nosy List ft, vienessewaltzer
Assigned To ft Topics

Created on 2011-05-09.15:13:13 by vienessewaltzer, last changed 2011-05-18.11:13:53 by mika.

Messages
msg3789 (view) Author: ft Date: 2011-05-18.11:12:53
Michael Prokop wrote:
> Any objections against closing this bugreport here in Grml's BTS?

Oops, been meaning to do that... sorry.


Regards, Frank
msg3788 (view) Author: mika Date: 2011-05-18.11:05:19
Any objections against closing this bugreport here in Grml's BTS?

regards,
-mika-
msg3765 (view) Author: ft Date: 2011-05-09.19:43:57
Michael Prokop wrote:
> * Bobby wrote in grml's BTS on 20110509 / 21:27:
>> I actually thought the same thing when I first started looking at this (in 
>> regards to the version)! Exec zsh does the same thing.  I haven't tried removing 
>> all aliases yet (and will), but I wanted to show you what I found in the 
>> debugger because after I said I wasn't running into any infinite loops I think I 
>> may have run into one.
> [...]
>
> I just tried to verify the problem on my own and definitely run into
> an infinite loop which is debuggable in gdb.
>
> AFAICT the problem is that Ubuntu took Debian's 4.3.11-3 version,
> applied their own stuff and uploaded as 4.3.11-4ubuntu2.is.3ubuntu1
> whereas Debian's zsh 4.3.11-4/4.3.11-5 includes bugfixes that are
> supposed to address this issue. So this should be reported to Ubuntu
> (and the developers should be asked why they are breaking version
> numbers, sigh).

Yeah.

Just for the record. I think this is the same problem as described in
#353863:

    <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=353863>

The upstream fix for that is included in debian's `4.3.11-4' but *NOT* in
ubuntu's `zsh_4.3.11-4ubuntu2.is.3ubuntu1':

    <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=353863#75>


FWIW, I can't reproduce this issue on a `squeeze' system with grml's
zshrc and a very recent git-build of `zsh' (which obviously also
includes said patch).

Regards, Frank
msg3764 (view) Author: vienessewaltzer Date: 2011-05-09.19:41:02
dpkg-query --showformat='${Version}/n' -W zsh
4.3.11-4ubuntu2.is.3ubuntu1/n%          

Yeah, looks like you're right.

I should be able to add a repo for the correct one to sources.list, right?  
Also, how would I go about notifying the ubuntu devs?
msg3763 (view) Author: mika Date: 2011-05-09.19:35:24
* Bobby wrote in grml's BTS on 20110509 / 21:27:

> I actually thought the same thing when I first started looking at this (in 
> regards to the version)! Exec zsh does the same thing.  I haven't tried removing 
> all aliases yet (and will), but I wanted to show you what I found in the 
> debugger because after I said I wasn't running into any infinite loops I think I 
> may have run into one.

[...]

I just tried to verify the problem on my own and definitely run into
an infinite loop which is debuggable in gdb.

AFAICT the problem is that Ubuntu took Debian's 4.3.11-3 version,
applied their own stuff and uploaded as 4.3.11-4ubuntu2.is.3ubuntu1
whereas Debian's zsh 4.3.11-4/4.3.11-5 includes bugfixes that are
supposed to address this issue. So this should be reported to Ubuntu
(and the developers should be asked why they are breaking version
numbers, sigh).

regards,
-mika-
msg3762 (view) Author: ft Date: 2011-05-09.19:33:32
Frank Terbeck wrote:
[...]
>> ii  zsh            4.3.11-4ubuntu A shell with lots of features
>
> Huh. Well, the thing I though it was, was fixed in debian package
> version 4.3.11-4; and that's what 4.3.11-4ubuntu* should be based
> upon. :-/

Okay well... *sigh*

Apparently, Ubuntu thinks that `zsh_4.3.11-4ubuntu2.is.3ubuntu1' is a
reasonable version number. That one doesn't have the fix I was thinking
about.

Please do the following to get the entire version string:

  % dpkg-query --showformat='${Version}\n' -W zsh

Regards, Frank
msg3761 (view) Author: vienessewaltzer Date: 2011-05-09.19:27:28
I actually thought the same thing when I first started looking at this (in 
regards to the version)! Exec zsh does the same thing.  I haven't tried removing 
all aliases yet (and will), but I wanted to show you what I found in the 
debugger because after I said I wasn't running into any infinite loops I think I 
may have run into one.


(gdb) 
mb_metacharlenconv_r (s=0xebfc81 "", wcp=0x0, mbsp=0x6ae630)
    at ../../Src/utils.c:4389
4389	{
(gdb) 
4395	    for (ptr = s; *ptr; ) {
(gdb) 
4389	{
(gdb) 
4395	    for (ptr = s; *ptr; ) {
(gdb) 
4414	    if (wcp)
(gdb) 
4421		return 0;		/* Probably shouldn't happen */
(gdb) 
4418	    if (ptr > s) {
(gdb) 
85	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) 
4418	    if (ptr > s) {
(gdb) 
4422	}
(gdb) 
get_comp_string (lst=4) at ../../../Src/Zle/zle_tricky.c:1486
1486			if (itype_end(tt, IIDENT, 1) == tt)
(gdb) 
itype_end (ptr=0xebfc81 "", itype=128, once=1) at ../../Src/utils.c:3491
3491	{
(gdb) 
3493	    if (isset(MULTIBYTE) &&
(gdb) 
3494		(itype != IIDENT || !isset(POSIXIDENTIFIERS))) {
(gdb) 
3495		mb_metacharinit();
(gdb) 
mb_metacharinit () at /usr/include/bits/string3.h:85
85	  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
(gdb) 
mb_metacharinit () at ../../Src/utils.c:450
450	}
(gdb) 
itype_end (ptr=0xebfc81 "", itype=128, once=1) at ../../Src/utils.c:3496
3496		while (*ptr) {
(gdb) 
3562	}
(gdb) 
get_comp_string (lst=4) at ../../../Src/Zle/zle_tricky.c:1487
1487			    nnb = tt + nclen;
(gdb) 
1488			tt += nclen;
(gdb) 
1487			    nnb = tt + nclen;
(gdb) 
1488			tt += nclen;
(gdb) 
1475		for (tt = s; tt < s + zlemetacs_qsub - wb;) {
(gdb) 
1476		    if (*tt == Inbrack) {
(gdb) 
1481		    } else if (i && *tt == Outbrack) {
(gdb) 
1485			int nclen = MB_METACHARLEN(tt);
(gdb) 
mb_metacharlenconv (s=0xebfc81 "", wcp=0x0) at ../../Src/utils.c:4439
4439	    if (!isset(MULTIBYTE)) {
(gdb) 
4455	    if (itok(*s)) {
(gdb) 
4461	    return mb_metacharlenconv_r(s, wcp, &mb_shiftstate);
(gdb) 
mb_metacharlenconv_r (s=0xebfc81 "", wcp=0x0, mbsp=0x6ae630)
    at ../../Src/utils.c:4389
4389	{
(gdb) 
4395	    for (ptr = s; *ptr; ) {
(gdb) 
4389	{
(gdb) 
4395	    for (ptr = s; *ptr; ) {
(gdb) 
4414	    if (wcp)
(gdb) 
4421		return 0;		/* Probably shouldn't happen */

I went through one iteration, but I got to the "Probably shouldn't happen" 
comment and figured that may be something of concern.  I'll report back on the 
aliases stuff momentarily!  Thanks for all the help.
msg3760 (view) Author: ft Date: 2011-05-09.19:17:41
Bobby wrote:
> dpkg -l zsh
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name           Version        Description
> +++-==============-==============-============================================
> ii  zsh            4.3.11-4ubuntu A shell with lots of features

Huh. Well, the thing I though it was, was fixed in debian package
version 4.3.11-4; and that's what 4.3.11-4ubuntu* should be based
upon. :-/

Are you sure the zsh you're running is the the one from the binary
(ie. you didn't upgrade it lately). If you're unsure, please do

  % exec zsh

...and retry.

If that still doesn't fix it, please try removing all aliases by doing
this:

  % for i in ${(k)aliases}; do unalias $i; done

If that still doesn't fix it... ...then I'm running out of ideas.

Regards, Frank
msg3759 (view) Author: vienessewaltzer Date: 2011-05-09.18:47:10
dpkg -l zsh
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  zsh            4.3.11-4ubuntu A shell with lots of features


aliases:
% alias
...='cd ../../'
0='return 0'
CH='./configure --help'
CO=./configure
GREP='grep -i --color=auto'
S=screen
acp='apt-cache policy'
acs='apt-cache search'
acsh='apt-cache show'
adg='sudo apt-get dist-upgrade'
ag='sudo apt-get upgrade'
agi='sudo apt-get install'
ati='sudo aptitude install'
au='sudo apt-get update'
calc=peval
cmplayer='mplayer -vo fbdev'
cp='nocorrect cp'
da='du -sch'
dbp=dpkg-buildpackage
default='echo -e "\033]50;-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-
15\007"'
dir='ls -lSrah'
fblinks='links2 -driver fb'
fbmplayer='mplayer -vo fbdev -fs -zoom'
g=git
ge=grep-excuses
grep='grep --color=auto'
help-zshglob=H-Glob
hide='echo -en "\033]50;nil2\007"'
http='python -m SimpleHTTPServer'
huge='echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-210-*-*-c-*-iso8859-
15\007"'
insecscp='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
j='jobs -l'
l='ls -lF --color=auto'
la='ls -la --color=auto'
lad='ls -d .*(/)'
large='echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-150-*-*-c-*-iso8859-
15\007"'
lh='ls -hAl --color=auto'
ll='ls -l --color=auto'
llog='sudo less /var/log/syslog'
ls='ls -b -CF --color=auto'
lsa='ls -a .*(.)'
lsbig='ls -flh *(.OL[1,10])'
lsd='ls -d *(/)'
lse='ls -d *(/^F)'
lsl='ls -l *(@)'
lsnew='ls -rl *(D.om[1,10])'
lsold='ls -rtlh *(D.om[1,10])'
lss='ls -l *(s,S,t)'
lssmall='ls -Srl *(.oL[1,10])'
lsw='ls -ld *(R,W,X.^ND/)'
lsx='ls -l *(*)'
md='mkdir -p'
mdstat='cat /proc/mdstat'
medium='echo -en "\033]50;-misc-fixed-medium-r-normal--13-120-75-75-c-80-
iso8859-15\007"'
mkdir='nocorrect mkdir'
mv='nocorrect mv'
new=modified
r--='chmod 644'
r-x='chmod 755'
rd=rmdir
rm='nocorrect rm'
rw-='chmod 600'
rwx='chmod 700'
s=ssh
semifont='echo -en "\033]50;-misc-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-
iso8859-15\007"'
small='echo -en "\033]50;6x10\007"'
smartfont='echo -en "\033]50;-artwiz-smoothansi-*-*-*-*-*-*-*-*-*-*-*-*\007"'
term2iso='echo '\''Setting terminal to iso mode'\'' ; print -n '\''\e%@'\'
term2utf='echo '\''Setting terminal to utf-8 mode'\''; print -n '\''\e%G'\'
tiny='echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-80-*-*-c-*-iso8859-
15\007"'
tlog='sudo tail -f /var/log/syslog'
top10='print -l ? ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
up='sudo aptitude update ; sudo aptitude safe-upgrade'
url-quote='autoload -U url-quote-magic ; zle -N self-insert url-quote-magic'
which-command=whence

Also, I've been running this through gdb and I'm not running into any infinite 
loops that I can see however my knowledge of the structure of zsh source is poor 
at best.
msg3758 (view) Author: ft Date: 2011-05-09.17:48:09
Bobby wrote:
> ls<tab> is what I'm trying.

Okay. In that case the version of ls doesn't matter. Neiter does `_ls'.

I've still got a suspicion:

  Which version of the ubuntu package is that?

    % dpkg -l zsh

  Which aliases are defined?

    % alias


Regards, Frank
msg3757 (view) Author: vienessewaltzer Date: 2011-05-09.16:03:52
ls<tab> is what I'm trying.

Output of ls --version:


ls --version
ls (GNU coreutils) 8.5
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Richard M. Stallman and David MacKenzie.

Output of cat ${^fpath}/_ls(N):

cat ${^fpath}/_ls(N)
#compdef ls gls
# Ulrik Haugen 2001

local arguments is_gnu

_pick_variant -r is_gnu gnu=gnu unix --help

if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*|darwin*) && "$is_gnu" != gnu ]]; 
then
  arguments=(
    '(-A)-a[list entries starting with .]'
    '(-a)-A[list all except . and ..]'
    '-d[list directory entries instead of contents]'
    '-L[list referenced file for sym link]'
    '-R[list subdirectories recursively]'

    '(-k)-h[print sizes in human readable form]'
    '(-h)-k[print sizes of 1k]'

    '-i[print file inode numbers]'

    '(-l -g -1 -C -m -x)-l[long listing]'
    '(-l -1 -C -m -x)-g[long listing but without owner information]'
    '(-l -g -C -m -x)-1[single column output]'
    '(-l -g -1 -m -x)-C[list entries in columns sorted vertically]'
    '(-l -g -1 -C -x)-m[comma separated]'
    '(-l -g -1 -C -m)-x[sort horizontally]'

    '-o[display file flags]'

    '-s[display size of each file in blocks]'

    '(-u)-c[status change time]'
    '(-c)-u[access time]'

    '-f[unsorted, all, short list]'
    '-r[reverse sort order]'

    '(-t)-S[sort by size]'
    '(-S)-t[sort by modification time]'

    '(-p)-F[append file type indicators]'
    '(-F)-p[append file type indicators for directory]'

    '-f[output is not sorted]'

    '-n[numeric uid, gid]'

    '-T[show complete time information]'

    '(-B -b -w -q)-B[print octal escapes for control characters]'
    '(-B -b -w -q)-b[as -B, but use C escape codes whenever possible]'
    '(-B -b -w -q)-q[hide control chars]'
    '(-B -b -w -q)-w[print raw characters]'

    '*:files:_files'
  )
  if [[ "$OSTYPE" = (freebsd*|darwin*) ]]; then
    arguments+=(
      '-G[enable colorized output]'
      '-H[follow symlinks on the command line]'
      '-P[do not follow symlinks]'
    )
  fi
else
  arguments=(
    '(--all -a -A --almost-all)'{--all,-a}'[list entries starting with .]'
    '(--almost-all -A -a --all)'{--almost-all,-A}'[list all except . and ..]'
    '--author[print the author of each file]'
    '(--ignore-backups -B)'{--ignore-backups,-B}"[don't list entries ending with 
~]"
    '(--directory -d)'{--directory,-d}'[list directory entries instead of 
contents]'
    '(--dired -D)'{--dired,-D}"[generate output designed for Emacs' dired mode]"
    '(--ignore,-I)'{--ignore,-I}"[don't list entire matching pattern]:pattern:"
    '(--dereference -L --dereference-command-line --dereference-command-line-
symlink-to-dir)'{--dereference,-L}'[list referenced file for sym link]'
    '(--dereference -L --dereference-command-line --dereference-command-line-
symlink-to-dir)'{--dereference-command-line,--dereference-command-line-symlink-
to-dir}
    '(--recursive -R)'{--recursive,-R}'[list subdirectories recursively]'

    '(--no-group -G)'{--no-group,-G}'[inhibit display of group information]'
    '(--human-readable -h -H --si)'{--human-readable,-h}'[print sizes in human 
readable form]'
    '(--si -H -h --human-readable)'{--si,-H}'[sizes in human readable form; 
powers of 1000]'
    '(--inode -i)'{--inode,-i}'[print file inode numbers]'

    '(--format -l -g -o -1 -C -m -x)-l[long listing]'
    '(--format -l -1 -C -m -x)-g[long listing but without owner information]'
    '(--format -l --no-group -G -1 -C -m -x)-o[no group, long]'
    '(--format -l -g -o -C -m -x)-1[single column output]'
    '(--format -l -g -o -1 -m -x)-C[list entries in columns sorted vertically]'
    '(--format -l -g -o -1 -C -x)-m[comma separated]'
    '(--format -l -g -o -1 -C -m)-x[sort horizontally]'
    '(-l -g -o -1 -C -m -x)--format=:format:(verbose long commas horizontal 
across vertical single-column)'

    '(--size -s -f)'{--size,-s}'[display size of each file in blocks]'

    '(--time -u)-c[status change time]'
    '(--time -c)-u[access time]'
    '(-c -u)--time=[specify time to show]:time:(ctime status use atime access)'
    '--time-style=[show times using specified style]:time style:(full-iso long-
iso iso locale)'

    '(-a --all -U -l --format -s --size -t --sort --full-time)-f[unsorted, all, 
short list]'
    '(--reverse)'{--reverse,-r}'[reverse sort order]'

    '(--sort -t -U -v -X)-S[sort by size]'
    '(--sort -S -U -v -X)-t[sort by modification time]'
    '(--sort -S -t -v -X)-U[unsorted]'
    '(--sort -S -t -U -X)-v[sort by version (filename treated numerically)]'
    '(--sort -S -t -U -v)-X[sort by extension]'
    '(-S -t -U -v -X)--sort=:sort:(size time none version extension)'

    '--color=-[control use of color]:color:(never always auto)'

    '(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append 
file type indicators]'
    '(--file-type -p --indicator-style -F --classify)'{--file-type,-p}'[append 
file type indicators except *]'
    '(-F --classify -p --file-type)--indicator-style=:indicator style:(none 
file-type classify)'

    '(-f)--full-time[list both full date and full time]'

    '(--kilobytes -k --block-size)'{--kilobytes,-k}'[use block size of 1k]'
    '(-k --kilobytes)--block-size=[specify block size]:block size (bytes):
(1024)'

    '(--numeric-uid-gid -n)'{--numeric-uid-gid,-n}'[numeric uid, gid]'
    '(--tabsize -T)'{--tabsize=,-T+}'[specify tab size]:tab size'
    '(--width -w)'{--width=,-w+}'[specify screen width]:screen width'

    '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--escape,-
b}'[print octal escapes for control characters]'
    '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-
N}'[print raw characters]'
    '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--quote-name,-
Q}'[quote names]'
    '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:
(literal shell shell-always c escape clocale locale)'

    '(--hide-control-chars -q --show-control-chars)'{--hide-control-chars,-
q}'[hide control chars]'
    '(-q --hide-control-chars)--show-control-chars'
    '(- :)--help[display help information]'
    '(- :)--version[display version information]'
    '*:files:_files'
  )
  # remove long options?
  if [[ $is_gnu != gnu ]]; then
    arguments=( ${${${arguments:#(|*\))--*}//--[^ )]#/}/\( #\)/} )
  fi
fi

_arguments -s $arguments

Hope that helps!
msg3756 (view) Author: ft Date: 2011-05-09.15:32:29
Bobby wrote:
> zsh version 4.3.11 with ubuntu 11.04 freezes with the ls command using
> the grml config.  Other commands work normally.

Well. Okay.

I'll need the *exact* command line you're using with the exact point
where the cursor is at upon hitting TAB. E.g.:

  % ls foo<tab>

Also, I'd like to know which version of `ls' you're using there:

  % ls --version

Also, I need to see the code of your `_ls' completer:

  % cat ${^fpath}/_ls(N)

With that I might be able to see what's going on.  If not, I might have
further questions. :)

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925
msg3754 (view) Author: vienessewaltzer Date: 2011-05-09.15:19:55
Output of patchlevel and version:

print $ZSH_PATCHLEVEL
Debian

print $ZSH_VERSION
4.3.11
msg3753 (view) Author: vienessewaltzer Date: 2011-05-09.15:16:55
zsh version 4.3.11 with ubuntu 11.04 freezes with the ls command using the grml 
config.  Other commands work normally.
History
Date User Action Args
2011-05-18 11:13:53mikasetstatus: need-eg -> resolved
2011-05-18 11:12:53ftsetmessages: + msg3789
2011-05-18 11:05:19mikasetstatus: chatting -> need-eg
messages: + msg3788
2011-05-09 19:43:58ftsetmessages: + msg3765
2011-05-09 19:41:02vienessewaltzersetmessages: + msg3764
2011-05-09 19:35:25mikasetmessages: + msg3763
2011-05-09 19:33:33ftsetmessages: + msg3762
2011-05-09 19:27:29vienessewaltzersetmessages: + msg3761
2011-05-09 19:17:42ftsetmessages: + msg3760
2011-05-09 18:47:12vienessewaltzersetmessages: + msg3759
2011-05-09 17:48:09ftsetmessages: + msg3758
2011-05-09 16:03:54vienessewaltzersetmessages: + msg3757
2011-05-09 15:56:32mikasetnosy: + vienessewaltzer
2011-05-09 15:32:31ftsetmessages: + msg3756
2011-05-09 15:22:15mikasetassignedto: ft
nosy: + ft
2011-05-09 15:19:56vienessewaltzersetmessages: + msg3754
2011-05-09 15:16:56vienessewaltzersetstatus: unread -> chatting
messages: + msg3753
2011-05-09 15:13:13vienessewaltzercreate