Re: [PATCH v5 58/58] perf python: Improve perf script -l descriptions

sashiko-bot
2026-04-24T17:35:35Z

Sashiko AI review found 1 potential issue(s):
- [Medium] The commit message claims to update the descriptions for `twatch.py` and `exported-sql-viewer.py`, but the updates are ineffective and result in a meaningful mismatch between the commit message and actual behavior.
--

commit 95fbe28eb15f529282a5c7b545c5be06fa83c1a1
Author: Ian Rogers <irogers@google.com>

perf python: Improve perf script -l descriptions

This commit adds docstrings to several Python scripts in the perf tools
to improve the descriptions shown when running "perf script -l".

[ ... ]
> diff --git a/tools/perf/python/exported-sql-viewer.py b/tools/perf/python/exported-sql-viewer.py
> index f3ac96ada1f51e..6d526a2502ca13 100755
> --- a/tools/perf/python/exported-sql-viewer.py
> +++ b/tools/perf/python/exported-sql-viewer.py
> @@ -1,6 +1,6 @@
> #!/usr/bin/env python
> # SPDX-License-Identifier: GPL-2.0
> -# exported-sql-viewer.py: view data from sql database
> +"""exported-sql-viewer.py: view data from sql database."""

Will "perf script -l" actually display this description?

Looking at read_script_info() in builtin-script.c, when it matches a
single-line docstring it copies the text and breaks out of the
quote-matching loop, but fails to break out of the file-reading
while loop.

Because exported-sql-viewer.py contains subsequent """ blocks later in the
file, won't the parser overwrite this newly added description with the later
text, leaking the memory allocated for the first string and preventing the
intended description from being displayed?

[ ... ]
> diff --git a/tools/perf/python/twatch.py b/tools/perf/python/twatch.py
> index 04f3db29b9bc18..e50cc2feb58a36 100755
> --- a/tools/perf/python/twatch.py
> +++ b/tools/perf/python/twatch.py
> @@ -1,5 +1,6 @@
> #! /usr/bin/env python
> # SPDX-License-Identifier: GPL-2.0-only
> +"""Example to show how to enable a tracepoint and access its fields."""

Does this suffer from the same issue?

Similar to exported-sql-viewer.py, twatch.py also contains subsequent """
blocks further down the file. The pre-existing parser behavior might cause
this update to be functionally ineffective, resulting in a mismatch between
the output claimed in the commit message and the actual command behavior.

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260424164721.2229025-1-irogers@google.com?part=58