Package: bash
Version: 3.0-15
Severity: normal
Tags: patch

Command completion for LVM Physical Volume and Logical Volume names is
broken. For example "lvdisplay /dev/<tab>" gives:

awk:                  ^ syntax error
awk: {if ($2 ~ /^/dev//) print $2}
awk:                   ^ unterminated regexp
awk: cmd. line:1: {if ($2 ~ /^/dev//) print $2}
awk: cmd. line:1:                              ^ unexpected newline or end of 
string

Device names typically contain forward slash characters ("/").
These need escaping before embedding them in awk patterns.

Patch attached.

Paul

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13-rc6-w
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)

Versions of packages bash depends on:
ii  base-files                  3.1.6        Debian base system miscellaneous f
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-8        Shared libraries for terminal hand
ii  passwd                      1:4.0.3-37   change and administer password and

bash recommends no packages.

-- no debconf information
--- bash_completion.old 2005-08-19 23:19:02.000000000 +0100
+++ bash_completion     2005-08-19 23:27:43.000000000 +0100
@@ -6762,13 +6762,13 @@
 _physicalvolumes()
 {
        COMPREPLY=( $( pvscan | \
-               awk '/PV/ {if ($2 ~ /^'$cur'/) print $2}' ) )
+               awk '/PV/ {if ($2 ~ /^'${cur//\//\\\/}'/) print $2}' ) )
 }
 
 _logicalvolumes()
 {
        COMPREPLY=( $( lvscan 2>/dev/null | \
-               awk -F"'" '{if ($2 ~ /^'$cur'/) print $2}' ) )
+               awk -F"'" '{if ($2 ~ /^'${cur//\//\\\/}'/) print $2}' ) )
 }
 
 _units()

Reply via email to