ports/131783: bash completion of paths beginning with ~ (tilde) do not execute

G Lassner bash_bug_71 at zyni.com
Tue Feb 17 16:00:09 UTC 2009


>Number:         131783
>Category:       ports
>Synopsis:       bash completion of paths beginning with ~ (tilde) do not execute
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 17 16:00:08 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     G Lassner
>Release:        FreeBSD 7.1
>Organization:
N/A
>Environment:
FreeBSD hosta 7.1-RELEASE-p2 FreeBSD 7.1-RELEASE-p2 #1: Sun Jan 18 12:39:43 MST 2009     root at hosta:/usr/src/sys/i386/compile/HOSTA  i386
>Description:

The bug that I am seeing has to do with the tilde expansion
function "_expand()" when using the "bash" port combined with
the "bash_completion" port.

I have been trying to find the source of this bug for a couple
of years now.  I am not sure whether it is in bash or
bash_completion.  It took me a long time to figure out the
conditions under which it occurred.  I determined in the last week that
by changing bash_completion I can work around the problem although
I still do not know what is the real root cause.

I downloaded several old versions of bash_completion from
http://www.caliban.org/files/bash/ and found that the change
occured between bash-completion-20030414 and 
bash-completion-20030419 and I further narrowed it down to 
"eval cur=$cur" vs ": eval cur=$cur".


*** bash_completion     Sun Feb 15 07:22:48 2009
--- bash_completion_fix Sun Feb 15 07:23:09 2009
***************
*** 276,282 ****

        # expand ~username type directory specifications
        if [[ "$cur" == \~*/* ]]; then
!               eval cur=$cur

        elif [[ "$cur" == \~* ]]; then
                cur=${cur#\~}
--- 276,282 ----

        # expand ~username type directory specifications
        if [[ "$cur" == \~*/* ]]; then
!               : eval cur=$cur

        elif [[ "$cur" == \~* ]]; then
                cur=${cur#\~}

I do not understand what the difference is between "eval cur=$cur" vs
": eval cur=$cur" or what the change was intended to fix.

However I wanted to bring some light to this and maybe someone who
is smarter or more experienced than I am can figure out what is 
really happening here.

>How-To-Repeat:
What I am seeing:

    [user1 at hosta /tmp]$ cd /home2/user1/4.10/
    [user1 at hosta /tmp]$
    >
    [user1 at hosta /tmp]$ pwd
    /tmp
    [user1 at hosta /tmp]$

What I am typing is "cd ~/4.1<tab>" which changes and completes
the directory to /home2/user1/4.10/ but never executes the command
it gives ">" prompt and seems to expect more input.

This is the old behavior which works as of bash-completion-20030414

    [user1 at hosta /tmp]$ cd ~/4.10/
    [user1 at hosta ~/4.10]$

cd is not the only command I have the issue with but it seems to
illustrate the problem the best.  Anytime you complete a command
option using <tab> that has a path that begins with "~" it seems
to have this issue.

I could not replicate this bug on Solaris 10.  I also tested on 
a 8.10 Ubuntu Linux system which also does not exhibit this issue.

>Fix:

Workaround (although I am not sure the problem is with bash_completion):

Edit bash_completion to add a colon ":" in front of "eval cur=$cur"
which occurs on line 279 of the /usr/local/etc/bash_completion file
as part of the bash-completion-20060301_3 port

*** bash_completion     Sun Feb 15 07:22:48 2009
--- bash_completion_fix Sun Feb 15 07:23:09 2009
***************
*** 276,282 ****

        # expand ~username type directory specifications
        if [[ "$cur" == \~*/* ]]; then
!               eval cur=$cur

        elif [[ "$cur" == \~* ]]; then
                cur=${cur#\~}
--- 276,282 ----

        # expand ~username type directory specifications
        if [[ "$cur" == \~*/* ]]; then
!               : eval cur=$cur

        elif [[ "$cur" == \~* ]]; then
                cur=${cur#\~}



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list