Bugs item #311431, was opened at 02/02/2009 21:42
>Status: Closed
Priority: 2
Submitted By: David Paleino (hanska-guest)
Assigned to: David Paleino (hanska-guest)
Summary: DBTS 489720: please do not expand leading tildes 
Distribution: None
Originally reported in: Debian BTS
Milestone: None
Status: Accepted
Original bug number: 489720


Initial Comment:
From: Morita Sho <morita-pub-en-deb...@inz.sakura.ne.jp>
To: Debian Bug Tracking System <sub...@bugs.debian.org>
Subject: bash-completion: Please do not expand leading tildes
Date: Mon, 07 Jul 2008 20:41:37 +0900

Package: bash-completion
Version: 20080705
Severity: minor
Tags: patch

Hi,

When bash-completion is not installed, the leading tilde will not be
expanded on completion.

$ ls ~testuser/testfile 
/home/testuser/testfile
$ ls ~testuser/testf[TAB]
     => ~testuser/testfile


However, when bash-completion is installed, the leading tilde will be
expanded on completion because _expand function performs the tilde
expansion. That is slightly annoying.

$ ls ~testuser/testf[TAB]
     => /home/testuser/testfile


IMHO, the tilde expansion in _expand seems needless because compgen
correctly handles leading tildes.
I suggest following patch.

--- bash_completion.orig        2008-07-07 14:07:28.000000000 +0900
+++ bash_completion     2008-07-07 17:28:59.000000000 +0900
@@ -353,7 +353,7 @@
 
        # expand ~username type directory specifications
        if [[ "$cur" == \~*/* ]]; then
-               eval cur=$cur
+               return
        elif [[ "$cur" == \~* ]]; then
                cur=${cur#\~}
                COMPREPLY=( $( compgen -P '~' -u $cur ) )


Regards,



----------------------------------------------------------------------

>Comment By: David Paleino (hanska-guest)
Date: 02/02/2009 21:43

Message:
From: David Paleino <d.pale...@gmail.com>
To: 489720-qu...@bugs.debian.org
Cc: Morita Sho <morita-pub-en-deb...@inz.sakura.ne.jp>, Bash-Completion 
Developers <bash-completion-devel@lists.alioth.debian.org>
Subject: [RFC] Re: bash-completion: Please do not expand leading tildes
Date: Sat, 6 Sep 2008 16:26:06 +0200

Hi Morita,

Morita Sho wrote:
> When bash-completion is not installed, the leading tilde > will not be 
> expanded on completion.
> 
> [..]
> 
> However, when bash-completion is installed, the leading 
> tilde will be expanded on completion because _expand 
> function performs the tilde expansion. That is slightly 
> annoying.
> 
> [..]
> 
> IMHO, the tilde expansion in _expand seems needless 
> because compgen correctly handles leading tildes.

I agree with you, and have committed the fix (rev1170), but I'm CCing the team 
because people might be relying on ~foo being expanded to /home/foo/, and I 
don't really know whether this fix might affect other software or not.

However, fix committed. I'll eventually revert it if it causes problems to 
other users (i.e. please don't re-file the bug if you see ~foo re-expanded to 
/home/foo/ in future versions ;) )

Kindly,
David

----------------------------------------------------------------------

You can respond by visiting: 
http://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311431&group_id=100114

_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel

Reply via email to