Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
geofft opened this issue Jan 30, 2025 · 1 comment
Open

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

geofft opened this issue Jan 30, 2025 · 1 comment

Comments

@geofft
Copy link
Collaborator

geofft commented Jan 30, 2025

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).

@geofft
Copy link
Collaborator Author

geofft commented Feb 6, 2025

Fixed in upstream valgrind: https://sourceware.org/git/?p=valgrind.git;a=commitdiff;h=1fefba79021779d840bbf8cebc43e40c74b40f31

I tested it and it seems to work, and I opened CodSpeedHQ/valgrind-codspeed#1 requesting that they backport this one patch, because from valgrind-announce archives, they seem to go anywhere from six months to a couple of years between releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant