From: Daniel Thompson <daniel.thompson@linaro.org>
To: Justin Stitt <justinstitt@google.com>
Cc: Jason Wessel <jason.wessel@windriver.com>,
Douglas Anderson <dianders@chromium.org>,
kgdb-bugreport@lists.sourceforge.net,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 0/7] kdb: Refactor and fix bugs in kdb_read()
Date: Tue, 23 Apr 2024 12:19:57 +0100 [thread overview]
Message-ID: <20240423111957.GD1567803@aspen.lan> (raw)
In-Reply-To: <kvmf4hcnoeuogggx5jmcqjch32shyswjv5cqvg4hwdg4g27rup@t4ddszao3354>
On Mon, Apr 22, 2024 at 10:49:29PM +0000, Justin Stitt wrote:
> Hi,
>
> On Mon, Apr 22, 2024 at 05:35:53PM +0100, Daniel Thompson wrote:
> > Inspired by a patch from [Justin][1] I took a closer look at kdb_read().
> >
> > Despite Justin's patch being a (correct) one-line manipulation it was a
> > tough patch to review because the surrounding code was hard to read and
> > it looked like there were unfixed problems.
> >
> > This series isn't enough to make kdb_read() beautiful but it does make
> > it shorter, easier to reason about and fixes two buffer overflows and a
> > screen redraw problem!
> >
> > [1]: https://lore.kernel.org/all/20240403-strncpy-kernel-debug-kdb-kdb_io-c-v1-1-7f78a08e9ff4@google.com/
> >
> > Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
>
> Seems to work nicely.
>
> There is some weird behavior which was present before your patch and is
> still present with it (let >< represent cursor position):
>
> [0]kdb> test_ap>< (now press TAB)
>
> [0]kdb> test_aperfmperf>< (so far so good, we got our autocomplete)
>
> [0]kdb> test_ap><erfmperf (now, let's move the cursor back and press TAB again)
>
> [0]kdb> test_aperfmperf><erfmperf
>
> This is because the autocomplete engine is not considering the
> characters after the cursor position. To be clear, this isn't really a
> bug but rather a decision to be made about which functionality is
> desired.
>
> For example, my shell (zsh) will just simply move the cursor back to
> the end of the complete match instead of re-writing stuff.
Interesting observation. I hadn't realized zsh does that. FWIW default
settings for both bash and gdb complete the same way as kdb. Overall
that makes me OK with the current kdb behaviour.
However I was curious about this and found "skip-completed-text" in
the GNU Readline documentation. I think that would give you zsh-like
completion in gdb if you ever want it!
> At any rate,
> Tested-by: Justin Stitt <justinstitt@google.com>
Thanks.
Daniel.
prev parent reply other threads:[~2024-04-23 11:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 16:35 [PATCH v2 0/7] kdb: Refactor and fix bugs in kdb_read() Daniel Thompson
2024-04-22 16:35 ` [PATCH v2 1/7] kdb: Fix buffer overflow during tab-complete Daniel Thompson
2024-04-22 21:39 ` Justin Stitt
2024-04-22 23:51 ` Doug Anderson
2024-04-23 10:17 ` Daniel Thompson
2024-04-22 16:35 ` [PATCH v2 2/7] kdb: Use format-strings rather than '\0' injection in kdb_read() Daniel Thompson
2024-04-22 23:52 ` Doug Anderson
2024-04-23 10:37 ` Daniel Thompson
2024-04-22 16:35 ` [PATCH v2 3/7] kdb: Fix console handling when editing and tab-completing commands Daniel Thompson
2024-04-22 23:52 ` Doug Anderson
2024-04-22 16:35 ` [PATCH v2 4/7] kdb: Merge identical case statements in kdb_read() Daniel Thompson
2024-04-22 23:52 ` Doug Anderson
2024-04-22 16:35 ` [PATCH v2 5/7] kdb: Use format-specifiers rather than memset() for padding " Daniel Thompson
2024-04-22 23:52 ` Doug Anderson
2024-04-22 22:49 ` [PATCH v2 0/7] kdb: Refactor and fix bugs " Justin Stitt
2024-04-23 11:19 ` Daniel Thompson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240423111957.GD1567803@aspen.lan \
--to=daniel.thompson@linaro.org \
--cc=dianders@chromium.org \
--cc=jason.wessel@windriver.com \
--cc=justinstitt@google.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox