bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with complete -W <wordlist> containing newlines


From: Markus Schwarzenberg
Subject: Problem with complete -W <wordlist> containing newlines
Date: Fri, 23 Nov 2001 14:18:14 +0100 (MET)

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.7
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' 
-DCONF_OSTYPE='solaris2.7' -DCONF_MACHTYPE='sparc-sun-solaris2.7' 
-DCONF_VENDOR='sun' -DSHELL -DHAVE_CONFIG_H  -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I.  -I. -I./include -I./lib 
-I/home/digital/schwarzenberg/sol57/include -O2
uname output: SunOS sund32 5.7 Generic_106541-16 sun4u sparc SUNW,Ultra-5_10
Machine Type: sparc-sun-solaris2.7

Bash Version: 2.05
Patch Level: 0
Release Status: release

Description:

! This report is for bash 2.05a released a few days ago, NOT bash 2.05 

compgen -W <wordlist> and complete -W <wordlist> fail 
if <wordlist> contains newline characters.

I get the following error message: (After stopping
the all-CPU-consuming running completion via CTRL-C):

malloc: subst.c:2618: assertion botched
free: underflow detected; mh_nbytes out of range
Stopping myself...

Often, bash terminates after that.

Repeat-By:

Use the following completion for example for cvs:

__cvs_arg2_words=
_complete_func_cvs () {
  
  COMPREPLY=()
  case $COMP_CWORD in 
    (1) __cvs_arg2_words=${__cvs_arg2_words:-$(cvs --help-commands 2>&1 | gawk  
'/^[ ]+.*/{print $1}')}
       COMPREPLY=( $( compgen -W "$__cvs_arg2_words"  ${COMP_WORDS[1]} ) ) 
       ;;
  esac
}
complete -F _complete_func_cvs -o default cvs

... and make an attempt to complete 'cvs c'
        

Fix:

Fix not known, but possible workaround: make <wordlist> contain
no spaces. Although that's not a problem it means additional 
code (at least a -vOFS=" " in the gawk command above) - and the
problem didn't exist in bash 2.05 

Markus Schwarzenberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]