#1106336 debfoster: bash tab completion says "have: command not found"

Package:
debfoster
Source:
debfoster
Description:
Install only wanted Debian packages
Submitter:
Daniel Kahn Gillmor
Date:
2025-05-27 05:19:01 UTC
Severity:
normal
Tags:
#1106336#5
Date:
2025-05-23 03:20:43 UTC
From:
To:
In bash, if i type /usr/sbin/debfoster and then hit TAB, i see the
following error on stderr (four times):

 bash: have: command not found

The bash tab completion rules do indeed try to call something named
"have" -- but maybe they're ancient?

```
$ head /usr/share/bash-completion/completions/debfoster
# -*- sh -*-

# Provided by Eric Hansander <ehdr@users.sourceforge.net> in
# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=349035>

have debfoster &&
_debfoster()
{
    local cur prev options

$
```

Regards,

#1106336#10
Date:
2025-05-23 05:14:10 UTC
From:
To:
have used to be defined for bash_completion snippets and got deprecated
some time one year ago. Sadly without any warning or obvious informaion,
and now it's gone.

Does your script work again when you replace have with
_comp_have_command?

Greetings
Marc

#1106336#15
Date:
2025-05-23 17:54:13 UTC
From:
To:
Hi Marc--

Thanks for the quick feedback here.

That seems unfortunate :(

I'm afraid it doesn't.  there is some sort of test in the final line of
/usr/share/bash-completion/completions/debfoster that reads like it
might be related to the old "have" functionality:

```
test "$have" && complete -F _debfoster $default debfoster
```

but i don't know the history of bash-completion well enough to know what
this means, or whether/how to rewrite this completion script myself.

#1106336#20
Date:
2025-05-23 18:38:50 UTC
From:
To:
Control: tags -1 help
Thanks

Neither do I. Tagging this bug help, but I might get around to take a
look sooner.

Thankfully it's only an annoyance.

Greetings
Marc

#1106336#27
Date:
2025-05-24 08:48:09 UTC
From:
To:
Try this patch:
--- original 2025-05-24 10:45:01.169219431 +0200 +++ /usr/share/bash-completion/completions/debfoster 2025-05-24 10:45:35.865115014 +0200 @@ -3,7 +3,7 @@ # Provided by Eric Hansander <ehdr@users.sourceforge.net> in # <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=349035>
#1106336#32
Date:
2025-05-26 19:44:03 UTC
From:
To:
Hi Marc--

Yes, this patch looks like it works for me.  thanks!

#1106336#37
Date:
2025-05-27 05:17:09 UTC
From:
To:
Hello,

Bug #1106336 in debfoster reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/debian/debfoster/-/commit/aa5e617ad5be2a643e675c33303c07acedbc01bc
------------------------------------------------------------------------
replace "have" with "_comp_have_command" in bash_completion

Thanks: Daniel Kahn Gillmor
Closes: #1106336
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1106336