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

sashiko-bot
2026-04-25T23:15:23Z

Sashiko AI review found 1 potential issue(s):
- [Medium] The commit message claims to update the description of 'twatch' in `perf script -l` output, but it fails to do so due to a parser flaw.
--

commit 1f01836466e9989f947fc7dd4eae069f6adf4d6f
Author: Ian Rogers <irogers@google.com>

perf python: Improve perf script -l descriptions

This commit updates the docstrings in several perf python scripts. These
strings are parsed and displayed as descriptions when listing available
scripts.

> $ perf script -l
> List of available scripts:
> ...
> counting Example for counting perf events.
> ...
> exported-sql-viewer exported-sql-viewer.py: view data from sql database.
> ...
> tracepoint Example showing how to enable a tracepoint and access its fields.
> twatch Example to show how to enable a tracepoint and access its fields.
> ...

Is the output shown for the twatch script accurate?

Due to a pre-existing parser flaw in read_script_info(), the loop does not
break when encountering single-line docstrings. Because twatch.py contains
other triple-quoted strings later in the file, the parser overwrites the
allocated desc->half_liner without freeing it.

Does this cause a memory leak and result in the parser extracting a later
line ("To test the PERF_RECORD_SWITCH...") as the description instead of
the one shown in this commit message?

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