[Bash-completion-devel] Bug#614775: bash-completion: perl -d inhibits filename completion

Jeff King peff at peff.net
Wed Feb 23 11:36:26 UTC 2011


Package: bash-completion
Version: 1:1.3-1
Severity: normal
Tags: patch

When trying to complete the name of a script after "-d", I get no
completions. E.g.:

  perl -d <tab>

The problem is that there are two cases:

  1. We are at "-d*", so we shift that into $prev, put the rest of it in
     $cur, and then look for ":*" in $cur.

  2. We are at "-d ", and $prev remains "-d", but we still try to look
     for ":*" in $cur.

So case (2) is wrong; we will complete "-d :DProf", which doesn't make
any sense (and isn't accepted by perl). And if you have no colon, you
get no completions at all.

There is a similar problem for "-V:" and "-M" (which will complete "-M
module", which perl complains about).

The attached patch fixes it for me. It looks for options in
$prev only if we did the $cur/$prev shift, and otherwise completes as
normal.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.37-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash-completion depends on:
ii  bash                          4.1-3      The GNU Bourne Again SHell

bash-completion recommends no packages.

bash-completion suggests no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bash-completion-perl.diff
Type: text/x-diff
Size: 3014 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20110223/bd9af24c/attachment.diff>


More information about the Bash-completion-devel mailing list