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

PermissionError when Hypothesis database dir path is not accessible #3764

Closed
Stranger6667 opened this issue Oct 8, 2023 · 3 comments · Fixed by #3924
Closed

PermissionError when Hypothesis database dir path is not accessible #3764

Stranger6667 opened this issue Oct 8, 2023 · 3 comments · Fixed by #3924
Labels
bug something is clearly wrong here

Comments

@Stranger6667
Copy link
Collaborator

After this change, checking for whether the given location is usable may lead to PermissionError, if the location has e.g. 0o222 permissions. Previously, os.path.exists did not raise an exception there. Found out about it downstream in Schemathesis - I guess that the expected behavior for the cases when the directory is not accessible is to work with an in-memory database, but it does not happen due to PermissionError

@Zac-HD Zac-HD added the bug something is clearly wrong here label Oct 8, 2023
@Stranger6667
Copy link
Collaborator Author

I also noted that it only affects Linux in Schemathesis's test suite

@Zac-HD
Copy link
Member

Zac-HD commented Oct 8, 2023

I guess we should wrap a try: ... / except OSError: return False around

while not path.exists():
# Loop terminates because the root dir ('/' on unix) always exists.
path = path.parent
return path.is_dir() and os.access(path, os.R_OK | os.W_OK | os.X_OK)

...and add a test for this specific case on Linux, too. I'll fix that this week, if you don't beat me to it.

@JonathanPlasse
Copy link
Contributor

I would like to take this on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is clearly wrong here
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants