diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-01-24 19:30:38 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-01-25 16:28:46 -0300 |
commit | 8b44f78b1daaaec142894f0ae28988ba46faf03c (patch) | |
tree | c27270afc4ceddc1bda6b03769868c382aa3eaa6 | |
parent | b9d93cd2a1ebfbc721258440c5c705d07abe6803 (diff) | |
download | bash-completion-8b44f78b1daaaec142894f0ae28988ba46faf03c.tar.gz |
Drop Debian patches that have been applied upstream
-rw-r--r-- | debian/patches/13-fix-perl-completions-with-a-space-between-option-and.patch | 124 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 0 insertions, 125 deletions
diff --git a/debian/patches/13-fix-perl-completions-with-a-space-between-option-and.patch b/debian/patches/13-fix-perl-completions-with-a-space-between-option-and.patch deleted file mode 100644 index 836fdf01..00000000 --- a/debian/patches/13-fix-perl-completions-with-a-space-between-option-and.patch +++ /dev/null @@ -1,124 +0,0 @@ -From: Jeff King <peff@peff.net> -Subject: Fix perl completions with a space between option and argument -Origin: vendor, https://bugs.debian.org/614775 -Bug-Debian: https://bugs.debian.org/614775 -Forwarded: yes, https://github.com/scop/bash-completion/pull/258 - -Most perl options do not allow a space between the switch and the -argument, however, bash-completion incorrectly suggests completions for -`-d', `-M` (or `-m'), and `-V', as reported in Debian bug #614775 [1], -as well as for `-x', which was not mentioned in the bug report. This -patch fixes the incorrect completions for these options, by falling back -to regular _filedir completion when a space is present. - -On the other hand, and unlike all other perl options, a space between -the `-e', `-E', and `-I' options and their arguments, e.g. `perl -e -"exit 2"', *is* valid syntax. However, the argument for `-e' and `-E' -is neither a filename nor a directory, but one line of perl program. -So, in order to keep the old behavior, which was correct, this patch -adds extra code that skips _filedir completion for `-e' and `-E' with a -space. - -Finally, the test case for `-x' requires changes, because it expects -that `-x' with a space should complete only with directories. That is -misleading, because it might suggest that the directory would be treated -as the argument to the `-x' option, when it will not, as can be verified -with the following test: - - $ cat test.pl - Some regular text with an embedded script - #!perl - use Cwd; - my $dir = getcwd; - print "$dir\n"; - __END__ - More text messages, not code. - -By executing the script with the `-x[dir]' option, the non-code part of -the file will be ignored, i.e. only the embedded script will be -executed. It will also be executed under [dir], if it is provided: - - $ perl -xperl/ test.pl - /tmp/perl - -However, if a space is present between `-x' and [dir], the script fails, -because the perl interpreter thinks that [dir] is a script, not the -argument to `-x': - - $ perl -x perl/ test.pl - Can't open perl script "perl/": Is a directory - -The rationale for the changes is based on `perl --help', which explains -that there are no spaces between options and arguments (see note below -for `-I'): - - $ perl --help | grep "\-d\|\-V\|-I\|-x\|-\[mM\]" - -d[:debugger] run program under debugger - -Idirectory specify @INC/#include directory (several -I's allowed) - -[mM][-]module execute "use/no module..." before executing program - -V[:variable] print configuration summary (or a single Config.pm variable) - -x[directory] ignore text before #!perl line (optionally cd to directory) - -When a space is required, `perl --help' makes it explicit: - - $ perl --help | grep "\-e\|-E" - -e program one line of program (several -e's allowed, omit programfile) - -E program like -e, but enables all optional features - -As an exception to this rule, `-I' does accept a space. ¬¬ - -[1] https://bugs.debian.org/614775 - ---- -diff --git a/completions/perl b/completions/perl -index 98ddb9eb..325c58d9 100644 ---- a/completions/perl -+++ b/completions/perl -@@ -27,7 +27,6 @@ _perl() - optPrefix=-P$prev - optSuffix=-S/ - prefix=$prev -- fi - - case $prev in - -*[DeEiFl]) -@@ -68,7 +67,23 @@ _perl() - ;; - esac - -- if [[ "$cur" == -* ]]; then -+ # Unlike other perl options, having a space between the `-e' and -+ # `-E' options and their arguments, e.g. `perl -e "exit 2"', is -+ # valid syntax. However, the argument is neither a filename nor a -+ # directory, but one line of perl program, thus do not suggest -+ # _filedir completion. -+ elif [[ "$prev" == -e ]] || [[ "$prev" == -E ]]; then -+ return -+ -+ # Likewise, `-I' also accepts a space between option and argument -+ # and it takes a directory as value. -+ elif [[ "$prev" == -I ]]; then -+ local IFS=$'\n' -+ compopt -o filenames -+ COMPREPLY=( $(compgen -d $optPrefix $optSuffix -- "$cur") ) -+ return -+ -+ 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 -diff --git a/test/t/test_perl.py b/test/t/test_perl.py -index 7c0c6094..21ac10f4 100644 ---- a/test/t/test_perl.py -+++ b/test/t/test_perl.py -@@ -67,8 +67,8 @@ class TestPerl: - - @pytest.mark.complete("perl -x shared/default/b") - def test_15(self, completion): -- """-x with space should complete dirs.""" -- assert completion == ["shared/default/bar bar.d/"] -+ """-x with space should complete files+dirs.""" -+ assert completion == ["bar", "bar bar.d/"] - - @pytest.mark.complete("perl -d:", env=dict(PERL5LIB="$PWD/perl")) - def test_16(self, completion): diff --git a/debian/patches/series b/debian/patches/series index 64120c80..ab68d6c7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,4 +3,3 @@ 06-xpdf_support_compressed_pdf.patch 07-dpkg_support_raw-extract_vextract.patch 11-add-completions-for-openrc-rc-service.patch -13-fix-perl-completions-with-a-space-between-option-and.patch |