Bug#614775: bash-completion: perl -d inhibits filename completion

2018-12-02 Thread Gabriel F. T. Gomes
On Sat, 24 Nov 2018 15:57:27 -0200 "Gabriel F. T. Gomes" 
 wrote:
> On Sat, 24 Nov 2018 12:53:38 -0200 "Gabriel F. T. Gomes" 
>  wrote:
> >
> > I'll apply it to Debian's bash-completion for the next upload.
> 
> Now in the git repository [1].  I'll wait for more changes (or more
> time) before doing a new upload.
> 
> [1] 
> https://salsa.debian.org/debian/bash-completion/commit/5506a39b0f16cee692f44c209a0d1a3b98fa969f

The above fix had a problem.  I updated it in the upstream pull request
[1] and in the Debian packagin git repository [2] (notice that this has
not yet been uploaded to the Debian archive, only integrated into the
git repository).

[1] https://github.com/scop/bash-completion/pull/258
[2] 
https://salsa.debian.org/debian/bash-completion/commit/d4e44fb5737f367c220b90a664794dc7552ebfa5



Bug#614775: bash-completion: perl -d inhibits filename completion

2018-11-24 Thread Gabriel F. T. Gomes
On Sat, 24 Nov 2018 12:53:38 -0200 "Gabriel F. T. Gomes" 
 wrote:
>
> I'll apply it to Debian's bash-completion for the next upload.

Now in the git repository [1].  I'll wait for more changes (or more
time) before doing a new upload.

[1] 
https://salsa.debian.org/debian/bash-completion/commit/5506a39b0f16cee692f44c209a0d1a3b98fa969f



Bug#614775: bash-completion: perl -d inhibits filename completion

2018-11-24 Thread Gabriel F. T. Gomes
Thanks for the patch.

I adpated it for current sources and forwarded it upstream as
https://github.com/scop/bash-completion/pull/258.

I'll apply it to Debian's bash-completion for the next upload.



Bug#614775: bash-completion: perl -d inhibits filename completion

2011-02-23 Thread Jeff King
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
diff --git a/completions/perl b/completions/perl
index 843e249..fca70fd 100644
--- a/completions/perl
+++ b/completions/perl
@@ -30,49 +30,48 @@ _perl()
 optPrefix=-P$prev
 optSuffix=-S/
 prefix=$prev
-fi
 
-case $prev in
--D|-e|-E|-i|-F|-l)
-return 0
-;;
--I|-x)
-local IFS=$'\n'
-_compopt_o_filenames
-COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- $cur ) )
-return 0
-;;
--m|-M)
-temp=${cur#-}
-prefix=$prefix${cur%$temp}
-cur=$temp
-_perlmodules $1
-return 0
-;;
--V)
-if [[ $cur == :* ]]; then
-temp=${cur##+(:)}
-prefix=$prefix${cur%$temp}
-local IFS=$'\n'
-COMPREPLY=( $( compgen -P $prefix -W \
-'$( $1 -MConfig -e print join \\\n\,
-keys %Config::Config 2/dev/null )' -- $temp ) )
-__ltrim_colon_completions $prefix$temp
-fi
-return 0
-;;
--d|-dt)
-if [[ $cur == :* ]]; then
-temp=${cur#:}
-prefix=$prefix${cur%$temp}
-cur=Devel::$temp
-_perlmodules $1
-fi
-return 0
-;;
-esac
+case $prev in
+-D|-e|-E|-i|-F|-l)
+return 0
+;;
+-I|-x)
+local IFS=$'\n'
+_compopt_o_filenames
+COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- $cur ) )
+return 0
+;;
+-m|-M)
+temp=${cur#-}
+prefix=$prefix${cur%$temp}
+cur=$temp
+_perlmodules $1
+return 0
+;;
+-V)
+if [[ $cur == :* ]]; then
+temp=${cur##+(:)}
+prefix=$prefix${cur%$temp}
+local IFS=$'\n'
+COMPREPLY=( $( compgen -P $prefix -W \
+'$( $1 -MConfig -e print join \\\n\,
+keys %Config::Config 2/dev/null )' -- $temp ) )
+__ltrim_colon_completions $prefix$temp
+fi
+return 0
+;;
+-d|-dt)
+if [[ $cur == :* ]]; then
+temp=${cur#:}
+prefix=$prefix${cur%$temp}
+cur=Devel::$temp
+_perlmodules $1
+fi
+return 0
+;;
+esac
 
-if [[ $cur == -* ]]; then
+elif [[ $cur == -* ]]; then
 COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
 -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
 else