[Bash-completion-devel] Error in 'service' file

Robby Workman rworkman at slackware.com
Tue Feb 1 18:59:16 UTC 2011


On Tue, 1 Feb 2011, Robby Workman wrote:

> Hey guys,
>
> I'm not sure what's going on here, but something in the 'service'
> file causes an error here; I grabbed the following output with
> "set -x" in the file (and a handy exit at the end):
>
> ++++ have service
> ++++ unset -v have
> ++++ 
> PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/sbin:/usr/sbin:/usr/local/sbin
> ++++ type service
> ++++ '[' -d /etc/init.d/ ']'
> ++++ complete -F _service service
> ++++ '[' -d /etc/init.d/ ']'
> +++++ for i in '/etc/init.d/*'
> +++++ complete -p README.functions
> +++++ for i in '/etc/init.d/*'
> +++++ complete -p functions
> ++++ complete -F _service -o default
> complete: usage: complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A action] 
> [-G globpat] [-W wordlist]  [-F function] [-C command] [-X filterpat] [-P 
> prefix] [-S suffix] [name ...]
>
> This is occurring with bash-completion 1.2 (also 1.1 if I manually add the
> 'service' file to /etc/bash_completion.d/) and bash-4.1.007 (4.1 with the
> patches through 007) on Slackware -current (our devel).
>
> We don't really use the SysV init layout, so perhaps we're missing some
> file that's expected, or perhaps that 'README.functions' file we place
> in /etc/init.d/ is a problem??


Replying to myself - it's fixed in git with this diff vs 1.2:

-[ -d /etc/init.d/ ] && complete -F _service -o default \
-    $(for i in /etc/init.d/*; do
-    complete -p ${i##*/} &>/dev/null || printf '%s\n' ${i##*/}; done)
+for svc in /etc/init.d/*; do
+    [ ! -x "$svc" ] || complete -p "${svc##*/}" &>/dev/null || \
+        complete -F _service -o default "${svc##*/}"
+done
+unset svc

Of course, the problem is obvious now  :-)

-RW



More information about the Bash-completion-devel mailing list