* [completion] GDB completion bug
@ 2020-11-22 22:39 Arusekk
2020-11-23 4:12 ` Daniel Shahaf
2021-04-08 22:39 ` Oliver Kiddle
0 siblings, 2 replies; 3+ messages in thread
From: Arusekk @ 2020-11-22 22:39 UTC (permalink / raw)
To: zsh-workers
Hello!
This is my first time with zsh development, so I hope I will not miss
anything. I am using zsh 5.8 shipped with Gentoo, no patches.
I use oh-my-zsh with plugins=(tig gitfast colored-man-pages colorize
command-not-found cp dirhistory autojump sudo fast-syntax-highlighting
zsh-autosuggestions)
and ZSH_THEME="powerlevel10k/powerlevel10k" and no further
customisations, but I hope this is irrelevant, just activates the
completion functions.
The bug is not critical in any way, but just happens in the following
setting:
zsh-5.8% gdb (cursor here) -h
Then it is enough to hit Tab. The -h can be any other option, or even a
file name, not really important, but there has to be space before
cursor, and after it (I guess so).
This is the error message:
_pids:shift:13: shift count must be <= $#
_pids:compadd:42: bad option: -m
I traced it down to most probably
/usr/share/zsh/5.8/functions/Completion/Unix/_gdb calling _pids, but I
do not know enough of zsh completion to investigate more.
Glad to have found a bug in such reliable software!
Arusekk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [completion] GDB completion bug
2020-11-22 22:39 [completion] GDB completion bug Arusekk
@ 2020-11-23 4:12 ` Daniel Shahaf
2021-04-08 22:39 ` Oliver Kiddle
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2020-11-23 4:12 UTC (permalink / raw)
To: Arusekk; +Cc: zsh-workers
Arusekk wrote on Sun, Nov 22, 2020 at 23:39:53 +0100:
> _pids:shift:13: shift count must be <= $#
> _pids:compadd:42: bad option: -m
I can reproduce this.
> I traced it down to most probably
> /usr/share/zsh/5.8/functions/Completion/Unix/_gdb calling _pids, but I do
> not know enough of zsh completion to investigate more.
fned it and add «typeset -p w >/dev/tty» right before the call and
you'll see that w=('' -h) at that point; then, the parameter expansion
in the call to _pids isn't quoted and expands to an empty string, hence
it's elided, causing the error.
Unsure of the fix.
Cheers,
Daniel
> Glad to have found a bug in such reliable software!
> Arusekk
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [completion] GDB completion bug
2020-11-22 22:39 [completion] GDB completion bug Arusekk
2020-11-23 4:12 ` Daniel Shahaf
@ 2021-04-08 22:39 ` Oliver Kiddle
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2021-04-08 22:39 UTC (permalink / raw)
To: Arusekk; +Cc: zsh-workers
On 22 Nov, Arusekk wrote:
> The bug is not critical in any way, but just happens in the following
> setting:
>
> zsh-5.8% gdb (cursor here) -h
> _pids:shift:13: shift count must be <= $#
> _pids:compadd:42: bad option: -m
In this case, I think we can fix this by limiting the search of the
$words array to words preceding the cursor as in the following patch.
I've also updated somewhat the pattern for options that might take
an argument in a following word.
In general, gdb completion could be improved quite a bit more.
> Glad to have found a bug in such reliable software!
> Arusekk
Thanks for reporting this and sorry for not dealing with it sooner.
Oliver
diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb
index 18f797633..6bdd55946 100644
--- a/Completion/Unix/Command/_gdb
+++ b/Completion/Unix/Command/_gdb
@@ -40,9 +40,9 @@ else
(-b) _baudrates && return 0 ;;
esac
- w=( "${(@)words[2,-1]}" )
+ w=( "${(@)words[2,CURRENT-1]}" )
while [[ "$w[1]" = -* ]]; do
- [[ "$w[1]" = -[decsxb] ]] && shift 1 w
+ [[ "$w[1]" = -(cd|se|tty|[decsxb]) ]] && shift 1 w
shift 1 w
done
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-08 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-22 22:39 [completion] GDB completion bug Arusekk
2020-11-23 4:12 ` Daniel Shahaf
2021-04-08 22:39 ` Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).