[Bash-completion-devel] Bug#489720: bash-completion: Please do not expand leading tildes

Morita Sho morita-pub-en-debian at inz.sakura.ne.jp
Mon Jul 7 11:41:37 UTC 2008


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,

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-2-686 (SMP w/1 CPU core)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages bash-completion depends on:
ii  bash                          3.2-4      The GNU Bourne Again SHell

bash-completion recommends no packages.

-- no debconf information






More information about the Bash-completion-devel mailing list