Skip to content

find_interpreter fragile across Python minor versions #23164

@cburroughs

Description

@cburroughs

See pex-tool/pex#3113 for background

In https://github.com/pantsbuild/pants/blob/2804a4673f/src/python/pants/backend/python/util_rules/pex.py#L386-L430

we hash the python binary, but that is not actually guaranteed to change across minor versions (So Python

More generally in https://github.com/pantsbuild/pants/blob/2804a4673f/src/python/pants/core/util_rules/system_binaries.py#L110 we generally assume that the binary only changes if something like the output of --version changes, but that is not true in the face of dynamic linking. Ex awk isn't just awk but:

$ ldd /usr/bin/awk
	linux-vdso.so.1 (0x00007f9513b81000)
	libreadline.so.8 => /usr/lib64/libreadline.so.8 (0x00007f9513a11000)
	libmpfr.so.6 => /usr/lib64/libmpfr.so.6 (0x00007f9513955000)
	libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007f95138ad000)
	libm.so.6 => /usr/lib64/libm.so.6 (0x00007f95137ef000)
	libc.so.6 => /usr/lib64/libc.so.6 (0x00007f9513624000)
	libtinfow.so.6 => /usr/lib64/libtinfow.so.6 (0x00007f95135e9000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9513b83000)

In the "extreme" python case from the linked issue, almost all of the code is in the .so files, not the "binary".

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