[SOLVED] Bash completion misbehaviour, quilt customization

Kernels & Hardware, configuring network, installing services

[SOLVED] Bash completion misbehaviour, quilt customization

Postby rockstorm » 2019-02-01 15:43

I'm getting some weird behaviour from the bash completion feature. I configured quilt as is explained in the New Maintainers Guide [1], so this two lines are currently on my '~/.bashrc' file:
Code: Select all
alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg"
complete -F _quilt_completion -o filenames dquilt


But it does not work as expected. I get:
Code: Select all
$ dquilt [Tab]
$ dquilt bash: completion: function `_quilt_completion' not found


quilt completion works fine:
Code: Select all
$ quilt [Tab]
add        edit       grep       mail       previous   revert     top
annotate   files      -h         new        push       series     unapplied
applied    fold       header     next       refresh    setup      upgrade
delete     fork       import     patches    remove     shell     
diff       graph      init       pop        rename     snapshot


I made sure the function is actually called "_quilt_completion" by looking at the quilt completion file, '/usr/share/bash-completion/completions/quilt", has this lines:
Code: Select all
_quilt_completion()
[...]
_quilt_complete_opt="-o filenames"
complete -F _quilt_completion $_quilt_complete_opt quilt
unset -v _quilt_complete_opt


So the function exists but it is somehow not finding it. But where it gets really weird is, if I run quilt and then the alias dquilt it works as expected for both:
Code: Select all
$ quilt [Tab]
add        edit       grep       mail       previous   revert     top
annotate   files      -h         new        push       series     unapplied
applied    fold       header     next       refresh    setup      upgrade
delete     fork       import     patches    remove     shell     
diff       graph      init       pop        rename     snapshot   
$ dquilt [Tab]
add        edit       grep       mail       previous   revert     top
annotate   files      -h         new        push       series     unapplied
applied    fold       header     next       refresh    setup      upgrade
delete     fork       import     patches    remove     shell     
diff       graph      init       pop        rename     snapshot


What am I missing? Please help, you don't realize how useful is this autocompletion thing until it fails :P

[1]: https://www.debian.org/doc/manuals/main ... ml#quiltrc

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

Kernel: Linux 4.19.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages quilt depends on:
ii bsdmainutils 11.1.2+b1
ii bzip2 1.0.6-9
ii diffstat 1.62-1
ii gettext 0.19.8.1-9
ii patch 2.7.6-3
ii perl 5.28.1-3
ii sensible-utils 0.0.12

Versions of packages quilt recommends:
ii less 487-0.1+b1

Versions of packages quilt suggests:
ii exim4-daemon-light [mail-transport-agent] 4.92~RC4-3
ii graphviz 2.40.1-5+b2
pn procmail <none>

-- no debconf information
Last edited by rockstorm on 2019-02-02 09:52, edited 1 time in total.
"What we have done for ourselves alone dies with us; what we have done for others and the world remains and is immortal."
― Albert Pike
rockstorm
 
Posts: 21
Joined: 2014-09-27 16:51

Re: Bash completion misbehaviour, quilt customization

Postby Head_on_a_Stick » 2019-02-01 19:31

The completion works for me in buster.

Have you created ~/.quiltrc-dpkg?
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Bash completion misbehaviour, quilt customization

Postby rockstorm » 2019-02-01 22:14

Head_on_a_Stick wrote:Have you created ~/.quiltrc-dpkg?


Hi, yes I have:
Code: Select all
$ cat .quiltrc-dpkg
d=. ; while [ ! -d $d/debian -a $(readlink -e $d) != / ]; do d=$d/..; done
if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then
    # if in Debian packaging tree with unset $QUILT_PATCHES
    QUILT_PATCHES="debian/patches"
    QUILT_PATCH_OPTS="--reject-format=unified"
    QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
    QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
    QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
    if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
fi


Any ideas on how to debug this further?
"What we have done for ourselves alone dies with us; what we have done for others and the world remains and is immortal."
― Albert Pike
rockstorm
 
Posts: 21
Joined: 2014-09-27 16:51

Re: Bash completion misbehaviour, quilt customization

Postby Head_on_a_Stick » 2019-02-01 22:34

Try adding
Code: Select all
_completion_loader quilt

just above the dquilt alias in ~/.bashrc
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Bash completion misbehaviour, quilt customization

Postby rockstorm » 2019-02-01 22:41

Yay! That works! Thanks a lot.

Any idea of why I need that line there? Have I misconfigured something?
"What we have done for ourselves alone dies with us; what we have done for others and the world remains and is immortal."
― Albert Pike
rockstorm
 
Posts: 21
Joined: 2014-09-27 16:51

Re: Bash completion misbehaviour, quilt customization

Postby Head_on_a_Stick » 2019-02-01 23:03

rockstorm wrote:Any idea of why I need that line there?

Not a scooby[1], sorry. That answer was brought to you by startpage.com :mrgreen:

[1] Scooby-Doo: clue
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to System configuration

Who is online

Users browsing this forum: Ika and 20 guests

fashionable