Package: bash-completion
Version: 20060301-3
Severity: normal
Tags: patch

In the definition of _get_cword in bash_completion, both $COMP_POINT 
and $word_start stand for offset in bytes, not in characters. However, 
in the ${variable:offset} expression, 'offset' must be in characters.
In a UTF-8 locale, when the completion string contains multibyte chars,
say, when we complete a command like "% cp ĂȘtre /<tab>", _get_cword 
will return the empty string instead of '/'.

This is easy to fix by setting locally LC_CTYPE to C in _get_cword.
The patch is attached.

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

Kernel: Linux 2.6.24martha (SMP w/1 CPU core; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages bash-completion depends on:
ii  bash                          3.2-1      The GNU Bourne Again SHell
ii  ucf                           3.005      Update Configuration File: preserv

bash-completion recommends no packages.

-- no debconf information
--- /usr/share/bash/bash_completion     2008-03-05 23:57:25.000000000 +0200
+++ ./bash_completion   2008-03-22 13:16:28.000000000 +0200
@@ -185,6 +185,7 @@
 # it will complete just "foo", not "foobar", which is what the user wants.)
 _get_cword()
 {
+    local LC_CTYPE=C
     local word_start
 
     cur=${COMP_LINE:0:$COMP_POINT}

Reply via email to