Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 610106

Summary: sys-apps/util-linux: umount bash completion breaks when 'mount' is aliased
Product: Gentoo Linux Reporter: Alex Efros <powerman-asdf>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal CC: into-the-trash-it-goes, shell-tools
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

Description Alex Efros 2017-02-20 17:58:39 UTC
Previous sys-apps/util-linux-2.26.2 doesn't have this issue because it doesn't provide /usr/share/bash-completion/completions/umount.

I've this alias in bash to show colorful output of `mount`:

  alias mount='grc mount'

and now when I use TAB to complete `umount /mnt/w<TAB>` I get ANSI escape sequence junk at end of umount:

  # mount /mnt/webdav.mailru/
  # umount /mnt/webdav.mailru^[[0m 

This happens because this line in /usr/share/bash-completion/completions/umount executes `grc mount` instead of /bin/mount:

  DEVS_MPOINTS="$(mount | awk '{print $1, $3}')"

I propose to change this line to one of:

  DEVS_MPOINTS="$(/bin/mount | awk '{print $1, $3}')"
  DEVS_MPOINTS="$(command mount | awk '{print $1, $3}')"

Latest ~arch util-linux-2.29.1-r1 also have same issue.
Comment 1 SpanKY gentoo-dev 2017-02-22 16:41:20 UTC
i don't know what the bash completion practices are in scenarios like this.  sounds like this is a generic problem with completions that users can break the env by redefining standard things.