Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] perf tools: Put Python bytecode in output directory
Date: Mon, 21 Sep 2026 18:05:43 +0000	[thread overview]
Message-ID: <20260921180544.064DB1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260921175719.846883-2-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf: root filesystem pollution or build failure due to stray slash in PYTHONPYCACHEPREFIX
--

commit 3de8bc01d44a9b11e10c327ec26bbff8605926df
Author: Ben Hutchings <benh@debian.org>

perf tools: Put Python bytecode in output directory

This commit sets the PYTHONPYCACHEPREFIX environment variable to relocate
the Python bytecode cache directory to the output directory during out-of-tree
builds. It also updates the python-clean rule to remove the new cache directory
and perf.pyi.

> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index a0b23d20d005c..50bde95c78a54 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -397,7 +397,8 @@ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
>  PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
>  export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
>  
> -python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
> +# Put Python bytecode in output directory
> +export PYTHONPYCACHEPREFIX := $(OUTPUT)/__pycache__

[Severity: Medium]
For in-tree builds where $(OUTPUT) is empty, does the unconditional inclusion
of the slash cause this to evaluate to the absolute path /__pycache__?

When Python 3.8+ runs during the build, it appears it would attempt to write
bytecode files to the root of the filesystem. Could this cause a regression
by breaking the build with permission errors for unprivileged users, or
silently pollute the root filesystem if executed as root?

[ ... ]

> @@ -919,7 +920,12 @@ $(INSTALL_DOC_TARGETS):
>  ### Cleaning rules
>  
>  python-clean:
> -	$(python-clean)
> +	$(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)__pycache__ \

[Severity: Medium]
Since $(OUTPUT)__pycache__ would evaluate to __pycache__ in the current
directory during in-tree builds, would this fail to clean the incorrectly
placed bytecode directory at the root of the filesystem?

> +		$(OUTPUT)python/perf*.so
> +	@if [ "$(abspath python/perf.pyi)" != "$(abspath $(OUTPUT)python/perf.pyi)" ]; \
> +	then \
> +		$(RM) $(OUTPUT)python/perf.pyi; \
> +	fi

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

  reply	other threads:[~2026-09-21 18:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 14:34 [PATCH 0/3] Fix out-of-tree build of some tools Ben Hutchings
2026-05-21 14:35 ` [PATCH 1/3] rtla: Fix output files in source tree Ben Hutchings
2026-05-21 14:48   ` Steven Rostedt
2026-05-21 14:53   ` sashiko-bot
2026-05-21 14:35 ` [PATCH 2/3] perf tools: Put Python egg info in output directory Ben Hutchings
2026-05-21 14:35 ` [PATCH 3/3] perf tools: Put Python bytecode " Ben Hutchings
2026-05-21 15:18   ` sashiko-bot
2026-05-21 17:50 ` [PATCH 0/3] Fix out-of-tree build of some tools Ian Rogers
2026-09-15 23:08   ` Ian Rogers
2026-09-21 17:57 ` [PATCH v2 1/2] perf tools: Put Python egg info in output directory Ian Rogers
2026-09-21 17:57   ` [PATCH v2 2/2] perf tools: Put Python bytecode " Ian Rogers
2026-09-21 18:05     ` sashiko-bot [this message]
2026-09-21 18:12       ` Ian Rogers
2026-09-21 18:03   ` [PATCH v2 1/2] perf tools: Put Python egg info " sashiko-bot
2026-09-28 16:12   ` Ian Rogers
2026-09-28 16:26     ` Arnaldo Carvalho de Melo

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=20260921180544.064DB1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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