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

avoid false positive PermissionError in declare_dependency #14342

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bonzini
Copy link
Collaborator

@bonzini bonzini commented Mar 7, 2025

If a directory that is passed to declare_dependency is not accessible (a parent has the x permission cleared), this can result in an OSError:

ERROR: Unhandled python OSError. This is probably not a Meson bug, but an issue with your build environment.

This can cause false positives, for example, if the directory is under /var and root-owned. Do the is_dir() test last, once it's known that the directory is related to the source directory, to avoid the false positives.

Fixes: #13584

@bonzini bonzini added the bug label Mar 7, 2025
@bonzini bonzini marked this pull request as ready for review March 7, 2025 12:06
@bonzini bonzini requested a review from jpakkane as a code owner March 7, 2025 12:06
@bruchar1 bruchar1 added this to the 1.7.1 milestone Mar 7, 2025
@bonzini bonzini force-pushed the fix13584 branch 2 times, most recently from cf05ccc to e6eb60b Compare March 7, 2025 14:17
@bonzini bonzini added the pathlib upgrading to/downgrading from pathlib.Path--including temporary workarounds for older Python label Mar 10, 2025
Path.is_dir() can raise a PermissionError if a parent does not have
the executable permission set; plus the "in p.parents" tests are
very expensive.  Do not use Path at all.

Signed-off-by: Paolo Bonzini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pathlib upgrading to/downgrading from pathlib.Path--including temporary workarounds for older Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

declare_dependency variable's value cannot be an unstatable file
3 participants