From nobody@FreeBSD.org  Tue Feb 17 15:57:49 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1B6B1065674
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 Feb 2009 15:57:49 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id B4E558FC16
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 Feb 2009 15:57:49 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n1HFvnSh051024
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 Feb 2009 15:57:49 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n1HFvnov051023;
	Tue, 17 Feb 2009 15:57:49 GMT
	(envelope-from nobody)
Message-Id: <200902171557.n1HFvnov051023@www.freebsd.org>
Date: Tue, 17 Feb 2009 15:57:49 GMT
From: G Lassner <bash_bug_71@zyni.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: bash completion of paths beginning with ~ (tilde) do not execute
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         131783
>Category:       ports
>Synopsis:       shells/bash-completion: bash completion of paths beginning with ~ (tilde) do not execute
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ehaupt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 17 16:00:08 UTC 2009
>Closed-Date:    Mon Mar 16 23:07:33 CET 2009
>Last-Modified:  Tue Mar 17 11:00:10 UTC 2009
>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@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@hosta /tmp]$ cd /home2/user1/4.10/
    [user1@hosta /tmp]$
    >
    [user1@hosta /tmp]$ pwd
    /tmp
    [user1@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@hosta /tmp]$ cd ~/4.10/
    [user1@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:
Responsible-Changed-From-To: freebsd-ports-bugs->obrien 
Responsible-Changed-By: tabthorpe 
Responsible-Changed-When: Wed Feb 18 16:57:28 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131783 
Responsible-Changed-From-To: obrien->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Mar 9 04:29:45 UTC 2009 
Responsible-Changed-Why:  
Port is maintained by kirk@strauser.com. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131783 
Responsible-Changed-From-To: freebsd-ports-bugs->ehaupt 
Responsible-Changed-By: ehaupt 
Responsible-Changed-When: Sun Mar 15 13:13:22 CET 2009 
Responsible-Changed-Why:  
I'm also seeing this. I'm willing to dig into it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131783 

From: Emanuel Haupt <ehaupt@FreeBSD.org>
To: bug-followup@FreeBSD.org, bash_bug_71@zyni.com
Cc:  
Subject: Re: ports/131783: shells/bash-completion: bash completion of paths
 beginning with ~ (tilde) do not execute
Date: Sun, 15 Mar 2009 14:08:16 +0100

 After the recent problems we saw during the update to bash4 [1] my gut
 feeling told me this could be somehow related to our system yacc.
 
 Since shells/bash is not using the system yacc anymore the expansion of
 ~user/dir/[enter] works perfect for me.
 
 Can you confirm that?
 
 [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/101230
State-Changed-From-To: open->closed 
State-Changed-By: ehaupt 
State-Changed-When: Mon Mar 16 23:06:12 CET 2009 
State-Changed-Why:  
Problem solved. Confirmed by submitter. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131783 

From: bf <bf2006a@yahoo.com>
To: bug-followup@FreeBSD.org, bash_bug_71@zyni.com,
  Emanuel Haupt <ehaupt@FreeBSD.org>
Cc:  
Subject: Re: ports/131783: shells/bash-completion: bash completion of paths beginning with ~ (tilde) do not execute
Date: Tue, 17 Mar 2009 03:55:08 -0700 (PDT)

 --- On Sun, 3/15/09, Emanuel Haupt <ehaupt@FreeBSD.org> wrote:
 
 > From: Emanuel Haupt <ehaupt@FreeBSD.org>
 > Subject: Re: ports/131783: shells/bash-completion: bash completion of paths beginning with ~ (tilde) do not execute
 > To: bug-followup@FreeBSD.org, bash_bug_71@zyni.com
 > Date: Sunday, March 15, 2009, 9:08 AM
 > After the recent problems we saw during the update to bash4
 > [1] my gut
 > feeling told me this could be somehow related to our system
 > yacc.
 > 
 > Since shells/bash is not using the system yacc anymore the
 > expansion of
 > ~user/dir/[enter] works perfect for me.
 > 
 > Can you confirm that?
 > 
 > [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/101230
 
 Yes, it seems to work properly now.  
 
 Now I'm wondering when the divergence between the current readline-6.0 and our old system readline is going to bite us  ...
 
 
 b.
 
 
       
>Unformatted:
