zsh-workers
 help / color / mirror / code / Atom feed
* Completion bug introduced in 3.0.3
@ 1997-07-02  3:48 Ingo Wilken
  1997-07-02  4:41 ` Geoff Wing
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ingo Wilken @ 1997-07-02  3:48 UTC (permalink / raw)
  To: zsh-workers; +Cc: Ingo Wilken

Hi,

I just upgraded from zsh 3.0.0 to 3.0.4 and noticed a severe bug with
filename completion in multiple-line commands.  I build all intermediate
versions, and noticed that this bug was introduced with 3.0.3.

I am in a directory with several hundred files (and some pretty long names),
and want to move them to another directory, with some prefix added to all
the names.  I type:

  ingo@icicle:/some/where/m1000> for i in *
  > do
  > mv -i $i ../m<tab>

I use autolist and automenu, so zsh should now print the possible matches
(in this case, m1000 and m980), but it does more than that: It adds a copy
of the uncompleted line to the script.  This copy also appears on the screen:

  ingo@icicle:/some/where/m1000> for i in *
  > do
  > mv -i $i ../m
  mv -i $i ../m
  m1000  m980
  > mv -i $i ../m[]
  mv -i $i ../m

[] is the cursor.  I can complete the line with automenu without problems,
but the script now contains two "mv" commands, which of course produce
lots of errors.  Going back in the history:

  ingo@icicle:/some/where/m1000> for i in *
  do
  mv -i $i ../m980/foo_$i    <-- line completed with automenu & some typing
  mv -i $i ../m              <-- copy produced by completion
  done

If I switch autolist and automenu off, hitting <tab> repeatedly creates
even more dupes:

  ingo@icicle:/some/where/m1000> for i in *
  > do
  > mv -i $i ../m[]
  mv -i $i ../m
  mv -i $i ../m
  mv -i $i ../m

This bug is in 3.0.3 and 3.0.4, 3.0.0 to 3.0.2 worked fine.


Another thing:  I use a TCL script that sets its stdout stream to
non-blocking.  This somehow affects zsh, as all interactive commands
started after the TCL script (like "ftp" or "more") immediately terminate
upon trying to get some user input:

  ingo@icicle:~> tclsh
  % fconfigure stdout -blocking 0
  % exit
  ingo@icicle:~> ftp
  ingo@icicle:~>              <-- zsh prompt, ftp terminated immediatly

Other shells, for example bash and tcsh, are immune to this.

My machine is a P133 with 64MB RAM, running Linux 2.0.30.  I added the
output of the reporter script below.

Regards,
Ingo


# START zsh saveset
# uname:  Linux icicle 2.0.30 #31 Wed Jun 25 10:17:55 MET DST 1997 i586

# Aliases.

alias ..='cd ..'
alias cls=clear
alias la=ls
alias ll='ls -l'
alias run-help=man
alias which-command=whence
alias xim='xterm -e vim'
alias xt='echo -n '\''^[]0;icicle\a'\'
alias xx='echo ^[c'

# Key bindings.

bindkey -r "^@"
bindkey -r "^A"
bindkey -r "^B"
bindkey -r "^C"
bindkey -r "^D"
bindkey -r "^E"
bindkey -r "^F"
bindkey -r "^G"
bindkey -r "^H"
bindkey -r "^I"
bindkey -r "^J"
bindkey -r "^K"
bindkey -r "^L"
bindkey -r "^M"
bindkey -r "^N"
bindkey -r "^O"
bindkey -r "^P"
bindkey -r "^Q"
bindkey -r "^R"
bindkey -r "^S"
bindkey -r "^T"
bindkey -r "^U"
bindkey -r "^V"
bindkey -r "^W"
bindkey -r "^X"
bindkey -r "^Y"
bindkey -r "^Z"
bindkey -r "\e"
bindkey -r "^_"
bindkey -r "^?"
bindkey -r "^X^B"
bindkey -r "^X^F"
bindkey -r "^X^J"
bindkey -r "^X^K"
bindkey -r "^X^N"
bindkey -r "^X^O"
bindkey -r "^X^U"
bindkey -r "^X^V"
bindkey -r "^X^X"
bindkey -r "^X*"
bindkey -r "^XG"
bindkey -r "^Xg"
bindkey -r "^Xr"
bindkey -r "^Xs"
bindkey -r "^Xu"
bindkey -r "\e^D"
bindkey -r "\e^G"
bindkey -r "\e^H"
bindkey -r "\e^I"
bindkey -r "\e^J"
bindkey -r "\e^L"
bindkey -r "\e^M"
bindkey -r "\e^_"
bindkey -r "\e "
bindkey -r "\e!"
bindkey -r "\e\\""
bindkey -r "\e$"
bindkey -r "\e'"
bindkey -r "\e-"
bindkey -r "\e."
bindkey -r "\e0"
bindkey -r "\e1"
bindkey -r "\e2"
bindkey -r "\e3"
bindkey -r "\e4"
bindkey -r "\e5"
bindkey -r "\e6"
bindkey -r "\e7"
bindkey -r "\e8"
bindkey -r "\e9"
bindkey -r "\e<"
bindkey -r "\e>"
bindkey -r "\e?"
bindkey -r "\eA"
bindkey -r "\eB"
bindkey -r "\eC"
bindkey -r "\eD"
bindkey -r "\eF"
bindkey -r "\eG"
bindkey -r "\eH"
bindkey -r "\eL"
bindkey -r "\eN"
bindkey -r "\eP"
bindkey -r "\eQ"
bindkey -r "\eS"
bindkey -r "\eT"
bindkey -r "\eU"
bindkey -r "\eW"
bindkey -r "\e[1~"
bindkey -r "\e[3~"
bindkey -r "\e[4~"
bindkey -r "\e[5~"
bindkey -r "\e[6~"
bindkey -r "\e[A"
bindkey -r "\e[B"
bindkey -r "\e[C"
bindkey -r "\e[D"
bindkey -r "\e_"
bindkey -r "\ea"
bindkey -r "\eb"
bindkey -r "\ec"
bindkey -r "\ed"
bindkey -r "\ef"
bindkey -r "\eg"
bindkey -r "\eh"
bindkey -r "\el"
bindkey -r "\en"
bindkey -r "\ep"
bindkey -r "\eq"
bindkey -r "\es"
bindkey -r "\et"
bindkey -r "\eu"
bindkey -r "\ew"
bindkey -r "\ex"
bindkey -r "\ey"
bindkey -r "\ez"
bindkey -r "\e|"
bindkey -r "\e^?"

bindkey "^@"	set-mark-command
bindkey "^A"	beginning-of-line
bindkey "^B"	backward-char
bindkey "^C"	undefined-key
bindkey "^D"	delete-char-or-list
bindkey "^E"	end-of-line
bindkey "^F"	forward-char
bindkey "^G"	send-break
bindkey "^H"	backward-delete-char
bindkey "^I"	expand-or-complete
bindkey "^J"	accept-line
bindkey "^K"	kill-line
bindkey "^L"	clear-screen
bindkey "^M"	accept-line
bindkey "^N"	down-line-or-history
bindkey "^O"	accept-line-and-down-history
bindkey "^P"	up-line-or-history
bindkey "^Q"	push-line
bindkey "^R"	history-incremental-search-backward
bindkey "^S"	history-incremental-search-forward
bindkey "^T"	transpose-chars
bindkey "^U"	kill-whole-line
bindkey "^V"	quoted-insert
bindkey "^W"	backward-kill-word
bindkey "^X"	prefix
bindkey "^Y"	yank
bindkey "^Z"	undefined-key
bindkey "\e"	prefix
bindkey "^_"	undo
bindkey "^?"	backward-delete-char
bindkey "^X^B"	vi-match-bracket
bindkey "^X^F"	vi-find-next-char
bindkey "^X^J"	vi-join
bindkey "^X^K"	kill-buffer
bindkey "^X^N"	infer-next-history
bindkey "^X^O"	overwrite-mode
bindkey "^X^U"	undo
bindkey "^X^V"	vi-cmd-mode
bindkey "^X^X"	exchange-point-and-mark
bindkey "^X*"	expand-word
bindkey "^XG"	list-expand
bindkey "^Xg"	list-expand
bindkey "^Xr"	history-incremental-search-backward
bindkey "^Xs"	history-incremental-search-forward
bindkey "^Xu"	undo
bindkey "\e^D"	list-choices
bindkey "\e^G"	send-break
bindkey "\e^H"	backward-kill-word
bindkey "\e^I"	self-insert-unmeta
bindkey "\e^J"	self-insert-unmeta
bindkey "\e^L"	clear-screen
bindkey "\e^M"	self-insert-unmeta
bindkey "\e^_"	copy-prev-word
bindkey "\e "	expand-history
bindkey "\e!"	expand-history
bindkey "\e\\""	quote-region
bindkey "\e$"	spell-word
bindkey "\e'"	quote-line
bindkey "\e-"	neg-argument
bindkey "\e."	insert-last-word
bindkey "\e0"	digit-argument
bindkey "\e1"	digit-argument
bindkey "\e2"	digit-argument
bindkey "\e3"	digit-argument
bindkey "\e4"	digit-argument
bindkey "\e5"	digit-argument
bindkey "\e6"	digit-argument
bindkey "\e7"	digit-argument
bindkey "\e8"	digit-argument
bindkey "\e9"	digit-argument
bindkey "\e<"	beginning-of-buffer-or-history
bindkey "\e>"	end-of-buffer-or-history
bindkey "\e?"	which-command
bindkey "\eA"	accept-and-hold
bindkey "\eB"	backward-word
bindkey "\eC"	capitalize-word
bindkey "\eD"	kill-word
bindkey "\eF"	forward-word
bindkey "\eG"	get-line
bindkey "\eH"	run-help
bindkey "\eL"	down-case-word
bindkey "\eN"	history-search-forward
bindkey "\eP"	history-search-backward
bindkey "\eQ"	push-line
bindkey "\eS"	spell-word
bindkey "\eT"	transpose-words
bindkey "\eU"	up-case-word
bindkey "\eW"	copy-region-as-kill
bindkey "\e[1~"	beginning-of-line
bindkey "\e[3~"	delete-char
bindkey "\e[4~"	end-of-line
bindkey "\e[5~"	history-search-backward
bindkey "\e[6~"	history-search-forward
bindkey "\e[A"	up-line-or-history
bindkey "\e[B"	down-line-or-history
bindkey "\e[C"	forward-char
bindkey "\e[D"	backward-char
bindkey "\e_"	insert-last-word
bindkey "\ea"	accept-and-hold
bindkey "\eb"	backward-word
bindkey "\ec"	capitalize-word
bindkey "\ed"	kill-word
bindkey "\ef"	forward-word
bindkey "\eg"	get-line
bindkey "\eh"	run-help
bindkey "\el"	down-case-word
bindkey "\en"	history-search-forward
bindkey "\ep"	history-search-backward
bindkey "\eq"	push-line
bindkey "\es"	spell-word
bindkey "\et"	transpose-words
bindkey "\eu"	up-case-word
bindkey "\ew"	copy-region-as-kill
bindkey "\ex"	execute-named-cmd
bindkey "\ey"	yank-pop
bindkey "\ez"	execute-last-named-cmd
bindkey "\e|"	vi-goto-column
bindkey "\e^?"	backward-kill-word

# Completions.

compctl -b bindkey
compctl -c builtin
compctl -v export
compctl -o setopt
compctl -v typeset
compctl -v unset
compctl -o unsetopt
compctl -v vared
compctl -c which
compctl -C -c
compctl -D -f
compctl -T

# Undefined functions.


# Defined functions.


# Limits.

limit stacksize       8MB
limit coredumpsize    0kB
limit maxproc         256
limit descriptors     256

# Non-array variables.

TERMCAP='xterm|vs100|xterm terminal emulator (X window system):do=^J:le=^H:ho=\E[H:co#80:li#24:cl=\E[H\E[2J:bs:am:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:md=\E[1m:mr=\E[7m:me=\E[m:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sf=
:sr=\EM:al=\E[L:dl=\E[M:im=\E[4h:ei=\E[4l:mi:dc=\E[P:MT:ks=\E[?1h\E=:ke=\E[?1l\E>:xn:AL=\E[%dL:DL=\E[%dM:DC=\E[%dP:hs:ts=\E[?E\E[?%i%dT:fs=\E[?F:es:ds=\E[?E:is=\E\E[m\E[?7h\E[?1;4l:cs=\E[%i%d;%dr:rs=\E[r\E<\E[m\E[H\E[2J\E[?7h\E[?1;3;4;6l:'
TERM='xterm'
\'#\'="0"
\'$\'="20188"
\'?\'="0"
ARGC="0"
AWK="awk"
BAUD="9600"
CDPATH="\'\'"
COLUMNS="80"
CPP="/lib/cpp"
DISPLAY=":0.0"
EGID="100"
ERRNO="0"
EUID="500"
FCEDIT="vi"
FIGNORE="\'\'"
FPATH="\'\'"
GID="100"
HISTCHARS="\'!^#\'"
HISTSIZE="30"
HOME="/home/ingo"
HOST="icicle"
HOSTNAME="icicle"
INPUTRC="/etc/inputrc"
IRCNAME="\'Ingo Wilken\'"
IRCNICK="Nobody"
IRCSERVER="irc.fu-berlin.de"
KEYTIMEOUT="40"
LD_LIBRARY_PATH=":/usr/local/lib:/usr/local/tcl/lib:/usr/local/tcl8.x/lib:/usr/local/lib:/usr/local/tcl/lib:/usr/local/tcl8.x/lib"
LESS="-MM"
LESSOPEN="\'|lesspipe.sh %s\'"
LINENO="329"
LINES="24"
LISTMAX="100"
LOGCHECK="60"
LOGNAME="ingo"
LS_COLORS="\'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:\'"
MACHTYPE="i586"
MAIL="/var/spool/mail/ingo"
MAILCHECK="60"
MAILPATH="\'\'"
MANPATH="/usr/local/man:/usr/man/preformat:/usr/man:/usr/X11/man:/usr/local/tcl/man:/usr/local/pbm/man:/usr/local/games/man"
MINICOM="\'-c on\'"
MODEM="/dev/modem"
NETHACKOPTIONS="rest_on_space,nopickup,catname:Sylvester,dogname:Brutus,fruit:Mango"
NNTPSERVER="\'\'"
NULLCMD="cat"
OLDPWD="/usr/src/zsh-3.0.3"
OPTARG="\'\'"
OPTIND="1"
OSTYPE="linux"
PATH="\'/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/bin:/usr/local/tcl/bin:/usr/local/pbm/bin:/usr/local/games/bin:~/bin:.:/usr/local/sbin::/usr/local/sbin::/usr/local/sbin:\'"
POSTEDIT="\'\'"
PPID="4389"
PROMPT="\'%n@%m:%~> \'"
PROMPT2="\'> \'"
PROMPT3="\'?# \'"
PROMPT4="\'+ \'"
PS1="\'%n@%m:%~> \'"
PS2="\'> \'"
PS3="\'?# \'"
PS4="\'+ \'"
PSVAR="\'\'"
PWD="/usr/src/zsh-3.0.3/Util"
RANDOM="31392"
READNULLCMD="more"
RPROMPT="\'[%D{%a %d %b, %H:%M:%S}]\'"
RPS1="\'[%D{%a %d %b, %H:%M:%S}]\'"
SECONDS="12"
SHELL="/bin/zsh"
SHLVL="3"
SPROMPT="\'zsh: correct \'\\'\'%R\'\\'\' to \'\\'\'%r\'\\'\' [nyae]? \'"
TCL_LIBRARY="/usr/local/tcl/lib/tcl7.5"
TIMEFMT="\'%J  %U user %S system %P cpu %*E total\'"
TK_LIBRARY="/usr/local/tcl/lib/tk4.1"
TMPPREFIX="/tmp/zsh"
TTY="/dev/ttyp2"
TTYIDLE="-1"
UID="500"
USERNAME="ingo"
VENDOR="pc"
WATCH="\'\'"
WATCHFMT="\'%n has %a %l from %m.\'"
WINDOWID="16777229"
WORDCHARS="\'*?_-.[]~=/&;!#$%^(){}<>\'"
ZSH_NAME="zsh"
ZSH_VERSION="3.0.3"
each="/bin"
histchars="\'!^#\'"
ignoreeof="0"
reporter_OSVersion="Linux_2.0.30"
reporter_junkiequotes="no"
status="0"
str="\'Linux icicle 2.0.30 #31 Wed Jun 25 10:17:55 MET DST 1997 i586\'"
prompt='test%'

# Array variables.

argv=()
'*'=()
cdpath=()
fignore=()
fpath=()
mailpath=()
manpath=(/usr/local/man /usr/man/preformat /usr/man /usr/X11/man /usr/local/tcl/man /usr/local/pbm/man /usr/local/games/man)
path=(/usr/local/bin /bin /usr/bin /usr/X11/bin /bin /usr/local/tcl/bin /usr/local/pbm/bin /usr/local/games/bin '~/bin' . /usr/local/sbin '' /usr/local/sbin '' /usr/local/sbin '')
psvar=()
signals=(EXIT HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR UNUSED ZERR DEBUG)
watch=()

# Exported variables.

export TERMCAP
export TERM
export COLUMNS=80
export DISPLAY=:0.0
export HOME=/home/ingo
export HOSTNAME=icicle
export INPUTRC=/etc/inputrc
export IRCNAME='Ingo Wilken'
export IRCNICK=Nobody
export IRCSERVER=irc.fu-berlin.de
export LD_LIBRARY_PATH=:/usr/local/lib:/usr/local/tcl/lib:/usr/local/tcl8.x/lib:/usr/local/lib:/usr/local/tcl/lib:/usr/local/tcl8.x/lib
export LESS=-MM
export LESSOPEN='|lesspipe.sh %s'
export LINES=24
export LOGNAME=ingo
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:'
export MAIL=/var/spool/mail/ingo
export MANPATH=/usr/local/man:/usr/man/preformat:/usr/man:/usr/X11/man:/usr/local/tcl/man:/usr/local/pbm/man:/usr/local/games/man
export MINICOM='-c on'
export MODEM=/dev/modem
export NETHACKOPTIONS=rest_on_space,nopickup,catname:Sylvester,dogname:Brutus,fruit:Mango
export NNTPSERVER=''
export PATH='/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/bin:/usr/local/tcl/bin:/usr/local/pbm/bin:/usr/local/games/bin:~/bin:.:/usr/local/sbin::/usr/local/sbin::/usr/local/sbin:'
export PROMPT='%n@%m:%~> '
export PS1='%n@%m:%~> '
export PS2='> '
export PWD=/usr/src/zsh-3.0.3/Util
export RPROMPT='[%D{%a %d %b, %H:%M:%S}]'
export SHELL=/bin/zsh
export SHLVL=3
export TCL_LIBRARY=/usr/local/tcl/lib/tcl7.5
export TERM=xterm
export TK_LIBRARY=/usr/local/tcl/lib/tk4.1
export WINDOWID=16777229
export ignoreeof=0

# Setopt.

setopt autocd
setopt autolist
setopt automenu
setopt extendedglob
setopt nobeep

# END zsh saveset


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

* Re: Completion bug introduced in 3.0.3
  1997-07-02  3:48 Completion bug introduced in 3.0.3 Ingo Wilken
@ 1997-07-02  4:41 ` Geoff Wing
  1997-07-02  5:43   ` Bart Schaefer
  1997-07-02  4:51 ` Zoltan Hidvegi
  1997-07-02  5:12 ` Bart Schaefer
  2 siblings, 1 reply; 8+ messages in thread
From: Geoff Wing @ 1997-07-02  4:41 UTC (permalink / raw)
  To: zsh-workers

On 2 Jul 1997 14:21:00 +1000,
Ingo Wilken <Ingo.Wilken@Informatik.Uni-Oldenburg.DE> wrote:
:  ingo@icicle:/some/where/m1000> for i in *
:  > do
:  > mv -i $i ../m
:  mv -i $i ../m
:  m1000  m980
:  > mv -i $i ../m[]
:  mv -i $i ../m

Reproduced gives:
BUG: xorrec: ll != strlen(line)

Hopefully shouldn't be too hard for someone to find (someone else, that is :-)
-- 
Geoff Wing [mason@primenet.com.au]   Technical Manager
  Phone    : +61-3-9818 2977         PrimeNet - Internet Consultancy
  Facsimile: +61-3-9819 3788         Web : <URL:http://www.primenet.com.au/>
  Mobile   : 0412 162 441


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

* Re: Completion bug introduced in 3.0.3
  1997-07-02  3:48 Completion bug introduced in 3.0.3 Ingo Wilken
  1997-07-02  4:41 ` Geoff Wing
@ 1997-07-02  4:51 ` Zoltan Hidvegi
  1997-07-02  6:10   ` Bart Schaefer
  1997-07-04  0:53   ` Ingo Wilken
  1997-07-02  5:12 ` Bart Schaefer
  2 siblings, 2 replies; 8+ messages in thread
From: Zoltan Hidvegi @ 1997-07-02  4:51 UTC (permalink / raw)
  To: Ingo Wilken; +Cc: zsh-workers

> I use autolist and automenu, so zsh should now print the possible matches
> (in this case, m1000 and m980), but it does more than that: It adds a copy
> of the uncompleted line to the script.  This copy also appears on the screen:

That's probably the same bug for which Peter sent a fix earlier, which is
included below.  Please try this, and tell me if it fixes your problem or
not.  There will be a zsh-3.0.5 release, and that's one of the reasons
that zsh-3.0.4 was not announced on zsh-announce.

> Another thing:  I use a TCL script that sets its stdout stream to
> non-blocking.  This somehow affects zsh, as all interactive commands
> started after the TCL script (like "ftp" or "more") immediately terminate
> upon trying to get some user input:
> 
>   ingo@icicle:~> tclsh
>   % fconfigure stdout -blocking 0
>   % exit
>   ingo@icicle:~> ftp
>   ingo@icicle:~>              <-- zsh prompt, ftp terminated immediatly

That one I cannot reproduce.  Does this happen with zsh-3.0.4?  Does this
happen when you use ttyctl -f before calling tclsh?  If it doesn't, what
stty shows without ttyctl -f after running tclsh?  I guess you also have
to use ftp with readline to get this problem.  Could you reprocude the
problem starting zsh with the -f option?

Zoltan


*** Src/Zle/zle_utils.c.sc	Sun Jun  1 07:50:52 1997
--- Src/Zle/zle_utils.c	Thu Jun 26 11:06:10 1997
***************
*** 75,81 ****
  	line[to] = line[to + cnt];
  	to++;
      }
!     ll = to;
  }
  
  /**/
--- 75,81 ----
  	line[to] = line[to + cnt];
  	to++;
      }
!     line[ll = to] = '\0';
  }
  
  /**/


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

* Re: Completion bug introduced in 3.0.3
  1997-07-02  3:48 Completion bug introduced in 3.0.3 Ingo Wilken
  1997-07-02  4:41 ` Geoff Wing
  1997-07-02  4:51 ` Zoltan Hidvegi
@ 1997-07-02  5:12 ` Bart Schaefer
  2 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 1997-07-02  5:12 UTC (permalink / raw)
  To: Ingo Wilken, zsh-workers; +Cc: Ingo Wilken

On Jul 2,  5:48am, Ingo Wilken wrote:
} Subject: Completion bug introduced in 3.0.3
}
} I just upgraded from zsh 3.0.0 to 3.0.4 and noticed a severe bug with
} filename completion in multiple-line commands.  I build all intermediate
} versions, and noticed that this bug was introduced with 3.0.3.

I can reproduce this bug with zsh -f plus setopt autolist automenu, when
built with the default config; but if I use configure --enable-zsh-debug
I'm no longer able to make it happen.  I'm recompiling again to make sure
of this ...

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


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

* Re: Completion bug introduced in 3.0.3
  1997-07-02  4:41 ` Geoff Wing
@ 1997-07-02  5:43   ` Bart Schaefer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 1997-07-02  5:43 UTC (permalink / raw)
  To: Ingo Wilken, zsh-workers, mason; +Cc: Ingo Wilken

On Jul 2,  5:48am, Ingo Wilken wrote:
} Subject: Completion bug introduced in 3.0.3
}
} Hi,
} 
} I just upgraded from zsh 3.0.0 to 3.0.4 and noticed a severe bug with
} filename completion in multiple-line commands.  I build all intermediate
} versions, and noticed that this bug was introduced with 3.0.3.

On Jul 2,  4:41am, Geoff Wing wrote:
} Subject: Re: Completion bug introduced in 3.0.3
}
} Reproduced gives:
} BUG: xorrec: ll != strlen(line)
} 
} Hopefully shouldn't be too hard for someone to find (someone else, that is :-)

I've confirmed that this bug is fixed by the patch to zle_utils.c that
PWS sent some days ago, which properly nul-terminates the `line' string.
My debugging version had the patch, my regular one did not, which is why
I was not able to reproduce with debugging.

Here's the patch again, against 3.0.4 instead of 3.1.2.

Index: Src/zle_utils.c
===================================================================
--- zle_utils.c	1997/06/27 18:37:08	1.1.1.3
+++ zle_utils.c	1997/06/29 02:21:59	1.4
@@ -73,7 +73,7 @@
 	line[to] = line[to + cnt];
 	to++;
     }
-    ll = to;
+    line[ll = to] = '\0';
 }
 
 /**/

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


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

* Re: Completion bug introduced in 3.0.3
  1997-07-02  4:51 ` Zoltan Hidvegi
@ 1997-07-02  6:10   ` Bart Schaefer
  1997-07-02  6:55     ` Zoltan Hidvegi
  1997-07-04  0:53   ` Ingo Wilken
  1 sibling, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 1997-07-02  6:10 UTC (permalink / raw)
  To: Zoltan Hidvegi, Ingo Wilken, zsh-workers

On Jul 2, 12:51am, Zoltan Hidvegi wrote:
} Subject: Re: Completion bug introduced in 3.0.3
}
} > Another thing:  I use a TCL script that sets its stdout stream to
} > non-blocking.  This somehow affects zsh, as all interactive commands
} > started after the TCL script (like "ftp" or "more") immediately terminate

I meant to mention this before ...

It's an extremely bad idea for any program to set a tty device for non-
blocking I/O.  This doesn't "somehow affect zsh," it affects the modes
of the file descriptor associated with the tty; which happens to be a
dup of the one zsh continues using for future processes, and therefore
it affects those processes as well.

I don't know why bash and tcsh don't show the problem -- either they are
explicitly resetting the blocking state, or they are using a different
scheme for setting up the stdin/out/err descriptors when they create
children.  (It's possible that they're using /dev/fd/ or /proc/$$/fd/
rather than dup().)

I don't think ttyctl -f is going to have any effect on this, because the
non-blocking I/O ioctl isn't one that's done through the tty driver
structures; a quick grep through the zsh sources doesn't reveal any
likely-looking calls.

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


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

* Re: Completion bug introduced in 3.0.3
  1997-07-02  6:10   ` Bart Schaefer
@ 1997-07-02  6:55     ` Zoltan Hidvegi
  0 siblings, 0 replies; 8+ messages in thread
From: Zoltan Hidvegi @ 1997-07-02  6:55 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hacking and development, Ingo.Wilken

> On Jul 2, 12:51am, Zoltan Hidvegi wrote:
> } Subject: Re: Completion bug introduced in 3.0.3
> }
> } > Another thing:  I use a TCL script that sets its stdout stream to
> } > non-blocking.  This somehow affects zsh, as all interactive commands
> } > started after the TCL script (like "ftp" or "more") immediately terminate
> 
> I meant to mention this before ...
> 
> It's an extremely bad idea for any program to set a tty device for non-
> blocking I/O.  This doesn't "somehow affect zsh," it affects the modes
> of the file descriptor associated with the tty; which happens to be a
> dup of the one zsh continues using for future processes, and therefore
> it affects those processes as well.

Perhaps I have a different tclsh, which resets the mode when it exits.  But
this can be tested with this little C program (nonblock.c):

#include <unistd.h>
#include <fcntl.h>

int
main(int argc, char *argv[])
{
    fcntl(0, F_SETFL, O_NONBLOCK);
    exit(0);
}

It sets stdin, but on a terminal this is the same as stdout.  Bash, ksh
and pdksh does seem to reset stdin on startup and before each prompt if
-s (shinstdin in zsh) is set, zsh doesn't.  POSIX says that blocking
input should be set on shell startup, but it does not seems to be
necessary to reset blocking mode after every application.  But blocking
mode should always be set when stdin is used, not only when shinstdin is
set.  Bash violates this:

nonblock; bash -c 'read foo; echo $foo'

does not set blocking read.  AT&T ksh93 does set blocking read here.
pdksh too, but pdksh always sets blocking mode, regardless of the use of
stdin.

Here is the relevant part of the standard (from www.rdg.opengroup.org):

    The standard input will be used only if one of the following is true: 

      o The -s option is specified. 

      o The -c option is not specified and no operands are specified. 

      o The script executes one or more commands that require input from
        standard input (such as a read command that does not redirect its
        input). 

    [...]

    If the standard input to sh is a FIFO or terminal device and is set to
    non-blocking reads, then sh will enable blocking reads on standard
    input. This will remain in effect when the command completes.  (This
    concerns an instance of sh that has been invoked, probably by a
    C-language program, with standard input that has been opened using the
    O_NONBLOCK flag; see open() in the XSH specification. If the shell did
    not reset this flag, it would immediately terminate because no input
    data would be available yet and that would be considered the same as
    end-of-file.)

I think that the AT&T ksh behaviour is the most conforming and most
logical one.

Zoltan


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

* Re: Completion bug introduced in 3.0.3
  1997-07-02  4:51 ` Zoltan Hidvegi
  1997-07-02  6:10   ` Bart Schaefer
@ 1997-07-04  0:53   ` Ingo Wilken
  1 sibling, 0 replies; 8+ messages in thread
From: Ingo Wilken @ 1997-07-04  0:53 UTC (permalink / raw)
  To: zsh-workers

Hi,

> That's probably the same bug for which Peter sent a fix earlier, which is
> included below.  Please try this, and tell me if it fixes your problem or
> not.

Thanks, the patch fixed it.

> That one I cannot reproduce.  Does this happen with zsh-3.0.4?  Does this
> happen when you use ttyctl -f before calling tclsh?  If it doesn't, what
> stty shows without ttyctl -f after running tclsh?  I guess you also have
> to use ftp with readline to get this problem.  Could you reprocude the
> problem starting zsh with the -f option?

It happens with -f, in all zsh-3.0.X version that I tried (including 3.0.4),
and also with the ttyctl command.  The weird thing is that stty -a shows no
difference if called before and after the TCL script.

Regards,
Ingo


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

end of thread, other threads:[~1997-07-04  1:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-02  3:48 Completion bug introduced in 3.0.3 Ingo Wilken
1997-07-02  4:41 ` Geoff Wing
1997-07-02  5:43   ` Bart Schaefer
1997-07-02  4:51 ` Zoltan Hidvegi
1997-07-02  6:10   ` Bart Schaefer
1997-07-02  6:55     ` Zoltan Hidvegi
1997-07-04  0:53   ` Ingo Wilken
1997-07-02  5:12 ` Bart Schaefer

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