Skip to content

Python scripts do not work under valgrind, including codspeed #508

Open
@geofft

Description

@geofft

This is https://bugs.kde.org/show_bug.cgi?id=396415 , but opening it here just for tracking/visibility. When running a script under valgrind mis-reports /proc/self/exe as the path to the script itself instead of the path to the script interpreter. This means that, at least on glibc/Linux, the $ORIGIN-relative library paths that are used by python-build-standalone don't get resolved correctly for scripts installed in a different directory to the Python interpreter (notably, those installed in a venv), and the Python interpreter fails to launch.

The minimal reproduction is something like valgrind --tool=none some/venv/bin/pytest (or just plain valgrind).

This was reported specifically as codspeed run pytest (invoked by CodSpeedHQ/action in GHA) not working. CodSpeed internally uses valgrind.

A workaround is to invoke the interpreter directly instead of using a script, either with an appropriate python -m command (e.g. python -m pytest), or by passing the script as an argument to the interpreter (e.g., python some/venv/bin/pytest).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions