bug-bash
[Top][All Lists]
Advanced

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

programmable completion bug


From: Louis Mamakos
Subject: programmable completion bug
Date: Mon, 27 May 2002 13:01:57 -0400 (EDT)

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd4.5
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='freebsd4.5' -DCONF_MACHTYPE='i386-portbld-freebsd4.5' 
-DCONF_VENDOR='portbld' -DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib 
-O -pipe
uname output: FreeBSD whizzo.transsys.com 4.5-STABLE FreeBSD 4.5-STABLE #10: 
Sun Apr 28 19:17:50 EDT 2002     
louie@whizzo.transsys.com:/a/obj/usr/src/sys/WHIZZO  i386
Machine Type: i386-portbld-freebsd4.5

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

Description:

Programmable completion has started to malfunction as noticed
in this release, compared to previous releases of bash.  This error
manifests itself with bash going off, consuming a bunch of
CPU time, and when interrupted during a real command completion,
reports of bad free() invocations from the C library.

This seems to be related to performing variable expansion when
compgen is invoked

Repeat-By:

create a couple of files:

$ cat >file1 <<EOF
1
2
3
4
5
EOF

$ cat >file2 <<EOF
1 2 3 4 5
EOF

$ var1=$(cat file1)
$ var2=$(cat file2)
$ set | egrep '^(var|IFS)'
IFS=$' \t\n'
var1=$'1\n2\n3\n4\n5'
var2='1 2 3 4 5'

This hangs:
        compgen -W "$var1" foo

This works:
        compgen -W "$var2" foo


This used to work in a completion function:

# --------------------------------
# hack at MH folder completion
# louie@transsys.com
#
# TODO: expand MH sequences at the right time for the right commands
#
_mh_folder_func()
{
        local cur f
        cur=${COMP_WORDS[COMP_CWORD]}
        case "$cur" in
        +*)
                # strip the leading '+'
                f=${cur#?}
                COMPREPLY=( $( compgen -P + -W "$(cat $(mhpath +)/.folders)" 
${f} ) )
echo $COMPREPLY
                return 0
                ;;
        esac
        return 0
}

complete -F _mh_folder_func    anno burst comp dist flist folder forw inc
complete -F _mh_folder_func    mark mhl mhn mhpath next pick prev rcvdist
complete -F _mh_folder_func    refile repl rmf rmm scan show sortm whatnow

# --------------------------------

Fix:



reply via email to

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