[Bash-completion-devel] Bug#322238: bash: [COMPLETION]: mounting to a subdirectory

David Paleino d.paleino at gmail.com
Sat Sep 6 16:23:55 UTC 2008


Hi Justin,

Yay! I got it!
I can't believe in 3 years nobody has noticed this...

On Tue, 9 Aug 2005 17:36:05 -0400, Justin Pryzby wrote:
> I have:
> 
> $ ls -l /mnt/
> total 8
> drwxr-xr-x  2 pryzbyj pryzbyj 4096 Mar 17 02:12 dipstick
> drwxr-xr-x  4 pryzbyj pryzbyj 4096 Aug  3 23:55 roars
> 
> $ ls -l /mnt/roars
> total 8
> drwxr-xr-x  2 pryzbyj pryzbyj 4096 Aug  3 23:55 astral
> drwxr-xr-x  2 pryzbyj pryzbyj 4096 Aug  3 23:55 share
> 
> and in /etc/fstab:
> 
> cetus.homeunix.net:/home/pryzbyj /mnt/cetus nfs defaults,users,noauto 0 0
> //roars/astral	/mnt/roars/astral smbfs
> defaults,user,noauto	0	0 //roars/share	/mnt/roars/share
> smbfs	defaults,user,noauto	0	0
> 
> When I type "mount /mnt/<tab><tab>" I see:
> 
>  cetus     dipstick/ astral/   share/    
> 
> astral/ and share/ are bogus, and completion of "mount /mnt/a" fails.

Please try this patch:

---8<---
--- bash_completion	2008-09-06 14:59:47 +0000
+++ bash_completion	2008-09-06 16:12:12 +0000
@@ -764,7 +764,7 @@
 
 	return 0
 }
-complete -F _mount $default $filenames mount
+complete -F _mount $default $dirnames mount
 
 # Linux rmmod(8) completion. This completes on a list of all currently
 # installed kernel modules.
--->8---

This is how it now behaves:

$ grep -v "^#" /etc/fstab
...
/dev/hda        /media/cdrom0   udf,iso9660 user,noauto     0       0
//studio/SharedDocs /media/Studio/Documenti smbfs [..]
...
$ mount /me<TAB>
$ mount /media/<TAB>
/media/cdrom0            /media/Studio/Documenti  
$ mount /media/S<TAB>
$ mount /media/Studio/Documenti/


I hope it doesn't have any side effect :) (it shouldn't though!) -- only it
writes the full path (instead of just cdrom0, for instance)

Yay! Another bug solved today ;)

Kindly,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20080906/dcb5bb6d/attachment-0002.pgp 


More information about the Bash-completion-devel mailing list