Bash-completion fails to parse spaces for umount

Bug #382037 reported by MrZaius
44
This bug affects 6 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: bash

This should be an easy one - When a mount point is created with a space in the name (in my case "SANSA CLIP"), bash auto-completion fails at the space.

umount /media/SANSA[TAB] yields "umount /media/SANSA " (note the space, but the lack of a complete path).

Seems to be isolated to umount, but may not be.

Thanks,
Sean Crago
aka MrZaius

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Versioning info:
cragos@cragos-desktop:~$ lsb_release -rd
Description: Ubuntu 9.04
Release: 9.04

cragos@cragos-desktop:~$ bash --version
bash --version
GNU bash, version 3.2.48(1)-release (i486-pc-linux-gnu)

cragos@cragos-desktop:~$ apt-cache policy bash
apt-cache policy bash
bash:
  Installed: 3.2-5ubuntu1
  Candidate: 3.2-5ubuntu1
  Version table:
 *** 3.2-5ubuntu1 0
        500 http://us.archive.ubuntu.com jaunty/main Packages
        100 /var/lib/dpkg/status

Matthias Klose (doko)
affects: bash (Ubuntu) → bash-completion (Ubuntu)
Revision history for this message
MrZaius (cragos) wrote :

Still present in Lucid.

Philip Muškovac (yofel)
tags: added: jaunty lucid
Revision history for this message
mnvl16 (mnvl16) wrote :

The patch below fixed this for me on karmic, hope it helps.

--- /etc/bash_completion 2010-07-01 21:38:36.000000000 +0100
+++ bash_completion 2010-11-20 10:07:56.150837242 +0000
@@ -831,8 +831,13 @@
 }
 complete -F _chgrp $filenames chgrp

-# umount(8) completion. This relies on the mount point being the third
-# space-delimited field in the output of mount(8)
+# umount(8) completion. The mount point should be the third
+# space-delimited field in the output of mount(8), however it
+# can itself contain spaces like any other filename of course.
+# The first two calls to 'sed' strip away the two preceding
+# and three following space-delimited fields
+# It might fail if any OTHER field except the mount point
+# contained a space, however it appears this does not happen.
 #
 _umount()
 {
@@ -841,7 +846,7 @@
  COMPREPLY=()
  cur=`_get_cword`

- COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( mount |sed '\''s/ type [^ ]* [^ ]*$//'\'' | sed '\''s/^[^ ]* on //'\'' | sed '\''s/ /\\ /g'\'' )' -- $cur ) )

  return 0
 }

Changed in bash-completion (Ubuntu):
status: New → In Progress
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Tagging patch, changing status to Confirmed from In Progress. Subscribing ubuntu review team.

Changed in bash-completion (Ubuntu):
status: In Progress → Confirmed
tags: added: patch
Revision history for this message
Aditya V (kroq-gar78) wrote :

Can't confirm this problem with Ubuntu 12.04 because I have the issue in bug 470037 instead

Revision history for this message
Andreas L (avl42) wrote :

adding info from https://answers.launchpad.net/bash-completion/+question/668391:

Problem is that apparently it is using the plain "umount"-completion rather than the "umount.linux"
If I source /usr/share/bash-completion/completions/umount.linux into running shell, then completion works correctly afterwards in that shell.

Maybe packagers for linux-distributions are supposed to divert umount to umount.linux?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.