[Bash-completion-devel] [bash-completion-Bugs][311431] DBTS 489720: please do not expand leading tildes

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Mon Feb 2 20:42:30 UTC 2009


Bugs item #311431, was opened at 02/02/2009 21:42
Status: Open
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-debian at inz.sakura.ne.jp>
To: Debian Bug Tracking System <submit at 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,



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

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



More information about the Bash-completion-devel mailing list