Skip to content

test_remote_exec_deleted_libpython can fail when DT_RPATH selects libpython #160388

Closed

Description

@zanieb

Bug report

On Linux/glibc, test_sys.TestRemoteExec.test_remote_exec_deleted_libpython can fail when the interpreter has a DT_RPATH that finds libpython. The test copies the library into a temporary directory and prepends that directory to LD_LIBRARY_PATH, expecting the child process to load the copy. glibc searches the interpreter's DT_RPATH first when there is no DT_RUNPATH, so the child can load the original library instead. After deleting the temporary copy, the test fails its assertion that the copy appears as a deleted mapping in /proc/<pid>/maps.

e.g.,

mkdir build-rpath
cd build-rpath
../configure --enable-shared --without-ensurepip \
    LDFLAGS="-Wl,--disable-new-dtags,-rpath,$PWD"
make -j8
./python -m test test_sys -m test_remote_exec_deleted_libpython -v

The test should explicitly preload its temporary copy of libpython so that the deleted-mapping assertion refers to the library actually loaded by the child.

Realistically, this is encountered when performing relocatable builds.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. self-assigned this
    on Oct 22, 2026
  2. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    on Oct 22, 2026
  3. added a commit that references this issue on Oct 23, 2026
  4. added 2 commits that reference this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions