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 <[email protected]> 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/[email protected]?part=2
