zsh-users
 help / color / mirror / code / Atom feed
* segfault when overriding complete-word then trying to use tab completion
@ 2002-03-01  0:16 Ian Lynagh
  2002-03-01  9:26 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Lynagh @ 2002-03-01  0:16 UTC (permalink / raw)
  To: zsh-users


Hi all

When overriding complete-word seemingly at random I either get binary
junk, a segfault, both or nothing (but never tab completion) when
pressing tab.

For example:

ian@majestica:~/.zsh% zsh
ian@majestica:~/.zsh% . ./z1
ian@majestica:~/.zsh% ls øå^M^H^HX^M^H^È^Y^Q^H^È^Y^Q^H( ^N^H( ^N^H0^Ê^[@0^Ê^[@8^Ê^[@8^Ê^[@°^Ë^P^HÀ^?^M^H^Øç^P^H^Øç^P^HP^Ê^[@P^Ê^[@X^Ê^[@X^Ê^[@`^Ê^[@`^Ê^[@@ð^M^H@ð^M^Hp^Ê^[@p^Ê^[@(^Q^N^H(^Q^N^H^À^Ê^[@^À^Ê^[@^È^Ê^[@^È^Ê^[@^Ð^Ê^[@^Ð^Ê^[@^Ø^Ê^[@^Ø^Ê^[@ ^Ê^[@ ^Ê^[@¨^Ê^[@¨^Ê^[@È^U^N^H "^N^Hð ^N^Høå^P^HÈBUFFERLINESøå^M^H^HX^M^H^È^Y^Q^H^È^Y^Q^H( ^N^H( ^N^H0^Ê^[@0^Ê^[@8^Ê^[@8^Ê^[@°^Ë^P^HÀ^?^M^H^Øç^P^H^Øç^P^HP^Ê^[@P^Ê^[@X^Ê^[@X^Ê^[@`^Ê^[@`^Ê^[@@ð^M^H@ð^M^Hp^Ê^[@p^Ê^[@(^Q^N^H(^Q^N^H^À^Ê^[@^À^Ê^[@^È^Ê^[@^È^Ê^[@^Ð^Ê^[@^Ð^Ê^[@^Ø^Ê^[@^Ø^Ê^[@ ^Ê^[@ ^Ê^[@¨^Ê^[@¨^Ê^[@È^U^N^H "^N^Hð ^N^Høå^P^HÈzsh: segmentation fault  zsh
ian@majestica:~/.zsh% cat z1

function complete-word {
    zle .complete-word
}
zle -N complete-word

ian@majestica:~/.zsh% bindkey -L | grep "\^I"
bindkey "^I" complete-word
ian@majestica:~/.zsh% 


Thanks
Ian


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

* Re: segfault when overriding complete-word then trying to use tab completion
  2002-03-01  0:16 segfault when overriding complete-word then trying to use tab completion Ian Lynagh
@ 2002-03-01  9:26 ` Bart Schaefer
  2002-03-01 12:32   ` Ian Lynagh
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2002-03-01  9:26 UTC (permalink / raw)
  To: Ian Lynagh, zsh-users

On Mar 1, 12:16am, Ian Lynagh wrote:
}
} When overriding complete-word seemingly at random I either get binary
} junk, a segfault, both or nothing (but never tab completion) when
} pressing tab.

I'm not able to reproduce this with any of 4.0.1, 4.0.4, or the latest
version from CVS.  I get tab completion just as expected.  What's your
hardware, OS, etc.?  Does this happen with `zsh -f'?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: segfault when overriding complete-word then trying to use tab completion
  2002-03-01  9:26 ` Bart Schaefer
@ 2002-03-01 12:32   ` Ian Lynagh
  2002-03-01 16:36     ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Lynagh @ 2002-03-01 12:32 UTC (permalink / raw)
  To: zsh-users

On Fri, Mar 01, 2002 at 09:26:21AM +0000, Bart Schaefer wrote:
> On Mar 1, 12:16am, Ian Lynagh wrote:
> }
> } When overriding complete-word seemingly at random I either get binary
> } junk, a segfault, both or nothing (but never tab completion) when
> } pressing tab.
> 
> I'm not able to reproduce this with any of 4.0.1, 4.0.4, or the latest
> version from CVS.  I get tab completion just as expected.  What's your
> hardware, OS, etc.?  Does this happen with `zsh -f'?

Linux/x86, zsh 4.0.4, and no, it doesn't happen with zsh -f.
It also doesn't happen if I . /etc/zshrc and then ./.zshrc in zsh -f. Is
there anything else I need to do to simulate the effect of -f not being
given so I can track the problem down?


Thanks
Ian


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

* Re: segfault when overriding complete-word then trying to use tab completion
  2002-03-01 12:32   ` Ian Lynagh
@ 2002-03-01 16:36     ` Bart Schaefer
  2002-03-01 17:25       ` Ian Lynagh
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2002-03-01 16:36 UTC (permalink / raw)
  To: zsh-users

On Mar 1, 12:32pm, Ian Lynagh wrote:
}
} Linux/x86, zsh 4.0.4, and no, it doesn't happen with zsh -f.

"Linix/x86" is not even close to specific enough.

} It also doesn't happen if I . /etc/zshrc and then ./.zshrc in zsh -f. Is
} there anything else I need to do to simulate the effect of -f not being
} given so I can track the problem down?

Look for /etc/zshenv, ~/.zshenv, /etc/zshrc ...

Your best bet is probably to run `zsh -x 2> xtrace.out', then immediately
exit from that shell and look at the xtrace.out file to see what commands
are being executed.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: segfault when overriding complete-word then trying to use tab completion
  2002-03-01 16:36     ` Bart Schaefer
@ 2002-03-01 17:25       ` Ian Lynagh
  2002-03-06  8:37         ` Sven Wischnowsky
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Lynagh @ 2002-03-01 17:25 UTC (permalink / raw)
  To: zsh-users

On Fri, Mar 01, 2002 at 04:36:50PM +0000, Bart Schaefer wrote:
> On Mar 1, 12:32pm, Ian Lynagh wrote:
> }
> } Linux/x86, zsh 4.0.4, and no, it doesn't happen with zsh -f.
> 
> "Linix/x86" is not even close to specific enough.

What exactly do you want to know then?
It's running 2.4.8-ac9, Debian, libc6 2.2.4-7.

ldd `which zsh` gives
        libcap.so.1 => /lib/libcap.so.1 (0x40020000)
        libdl.so.2 => /lib/libdl.so.2 (0x40024000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x40028000)
        libncurses.so.5 => /lib/libncurses.so.5 (0x4003d000)
        libm.so.6 => /lib/libm.so.6 (0x4007c000)
        libc.so.6 => /lib/libc.so.6 (0x4009e000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

> } It also doesn't happen if I . /etc/zshrc and then ./.zshrc in zsh -f. Is
> } there anything else I need to do to simulate the effect of -f not being
> } given so I can track the problem down?
> 
> Look for /etc/zshenv, ~/.zshenv, /etc/zshrc ...
> 
> Your best bet is probably to run `zsh -x 2> xtrace.out', then immediately
> exit from that shell and look at the xtrace.out file to see what commands
> are being executed.

Can you reproduce it if you also have this in your .zshrc?
Just running it later doesn't seem sufficient - _main_complete only
seems to execute if it's in there.

-----
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' matcher-list '' 'r:|[._-]=* r:|=*'
'm:{a-zA-Z}={A-Za-z}' 'm:{a-z}={A-Z} l:|=* r:|=*'
zstyle ':completion:*' max-errors 1
zstyle :compinstall filename '/home/ian/.zshrc'

autoload -U compinit
compinit
-----


Ta
Ian


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

* Re: segfault when overriding complete-word then trying to use tab completion
  2002-03-01 17:25       ` Ian Lynagh
@ 2002-03-06  8:37         ` Sven Wischnowsky
  2002-03-06 17:14           ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Sven Wischnowsky @ 2002-03-06  8:37 UTC (permalink / raw)
  To: zsh-users


Ian Lynagh wrote:

> ...
> 
> Can you reproduce it if you also have this in your .zshrc?
> Just running it later doesn't seem sufficient - _main_complete only
> seems to execute if it's in there.

I still can't reproduce it.  What we really need is a recipe to get it
starting with `zsh -f' (I know that you said it doesn't happen with
that, but...).

All in all it's almost certainly a memory allocation problem, which
means that the problem may be anywhere and just surfaces in the
completion code (of course the allocation bug may actually be in the
completion code -- and my fault).

You could try the reporter script from the distribution to dump the
state of your shell and then see if you reproduce it with `zsh -f' and
sources that.  If not, there are still several places where the bug
may be, history, for example.


Bye
  Sven

-- 
Sven Wischnowsky                          wischnow@berkom.de


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

* Re: segfault when overriding complete-word then trying to use tab completion
  2002-03-06  8:37         ` Sven Wischnowsky
@ 2002-03-06 17:14           ` Bart Schaefer
  2002-03-07 15:03             ` Ian Lynagh
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2002-03-06 17:14 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-users

On Mar 6,  9:37am, Sven Wischnowsky wrote:
} Subject: Re: segfault when overriding complete-word then trying to use tab
}
} I still can't reproduce it.

I can, but only in 4.0.1, not in 4.0.4 (so far) nor 4.1.x.

The problem is that .complete-word is a completion widget, but it's being
called from a function installed as a normal widget with `zle -N'.  This
confuses the completion code somehow -- I haven't got a sensible stack
trace -- but it appears in 4.1.x as though calling `zle .complete-word'
from a normal widget will bypass the new completion system and always
invoke compctl.

In 4.0.1, on the other hand, it appears to depend on the order in which
one runs `compinit' and `zle -N'.  Sometimes it invokes compctl and all
works well, other times it tries to invoke new completion and blows up.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: segfault when overriding complete-word then trying to use tab completion
  2002-03-06 17:14           ` Bart Schaefer
@ 2002-03-07 15:03             ` Ian Lynagh
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Lynagh @ 2002-03-07 15:03 UTC (permalink / raw)
  To: zsh-users

On Wed, Mar 06, 2002 at 05:14:27PM +0000, Bart Schaefer wrote:
> On Mar 6,  9:37am, Sven Wischnowsky wrote:
> } Subject: Re: segfault when overriding complete-word then trying to use tab
> }
> } I still can't reproduce it.
> 
> I can, but only in 4.0.1, not in 4.0.4 (so far) nor 4.1.x.

Excellent.

FWIW I couldn't reproduce it with zsh -f with the help of the reporter
script either.


Thanks
Ian


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

end of thread, other threads:[~2002-03-07 15:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-01  0:16 segfault when overriding complete-word then trying to use tab completion Ian Lynagh
2002-03-01  9:26 ` Bart Schaefer
2002-03-01 12:32   ` Ian Lynagh
2002-03-01 16:36     ` Bart Schaefer
2002-03-01 17:25       ` Ian Lynagh
2002-03-06  8:37         ` Sven Wischnowsky
2002-03-06 17:14           ` Bart Schaefer
2002-03-07 15:03             ` Ian Lynagh

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