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

Prevent copying tmp dir to itself in build backend #1014

Conversation

webknjaz
Copy link
Member

Previously, setting TMPDIR="$(pwd)/smth-inside" would cause the
in-tree PEP 517 build backend to go into infinite recursion,
attempting to copy the project directory into a nested folder.

Specifically, this is happening in the Fedora land because macros
used in RPM packaging (pyproject-rpm-macros) are setting it up
like this. Additionally, this is only happening with pip wheel and
doesn't affect pyproject-build, because the latter pre-copies the
project directory by itself early, and changes current working
directory to it while the former does not.

This patch addresses the issue by excluding the temporary directory
from traversal when copying the directory tree within the build
backend.

Fixes #992.

hroncok and others added 2 commits May 30, 2024 20:57
Previously, setting `TMPDIR="$(pwd)/smth-inside"` would cause the
in-tree PEP 517 build backend to go into infinite recursion,
attempting to copy the project directory into a nested folder.

Specifically, this is happening in the Fedora land because macros
used in RPM packaging (`pyproject-rpm-macros`) are setting it up
like this. Additionally, this is only happening with `pip wheel` and
doesn't affect `pyproject-build`, because the latter pre-copies the
project directory by itself early, and changes current working
directory to it while the former does not.

This patch addresses the issue by excluding the temporary directory
from traversal when copying the directory tree within the build
backend.

Fixes aio-libs#992.
This patch further improves Miro's submission 80ae8b6 to move the
ignoring logic into a top-level helper function and exclude the
parent tmp root directory, not just its subfolders.
@webknjaz webknjaz added the bug label May 30, 2024
webknjaz added a commit to webknjaz/yarl that referenced this pull request May 30, 2024
@webknjaz webknjaz force-pushed the bugfixes/992-packaging-in-tree-backend-tmp-copy-logic branch from 7a22d32 to 3d5a01b Compare May 30, 2024 19:34
@webknjaz webknjaz merged commit 5f9ebbb into aio-libs:master May 30, 2024
36 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When $TMPDIR is within $PWD, creating wheel dies on infinite recursion
2 participants