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

llnl.util.filesystem.find: restore old error handling #47463

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

haampie
Copy link
Member

@haampie haampie commented Nov 6, 2024

The point of #41945 was to introduce a max_depth parameter to
llnl.util.filesystem.find(root, ...).

However, it also made find(root, ...) more pedantic, as it started raising
OSError when os.stat(root) failed with any error code except ENOENT, and
started raising ValueError if root is not a directory.

This should not have been part of the PR, since there's a disagreement about
how useful this is, as it requires the call site to be defensive, and there are
many call sites possibly also in private repositories. Apart from that raising a
mix of OSError and ValueError seems awkward, and no tests were added
to cover the unhappy code path. How to handle errors best can then be settled
better after releases/v0.23 branches off.

This commit restores the 8 year status quo of not erroring (the recursive
search was based on os.walk, and the non-recursive just on glob, both
of which ignore all OSErrors by default).

@spackbot-app spackbot-app bot added core PR affects Spack core functionality utilities labels Nov 6, 2024
@alalazo alalazo merged commit a31c525 into develop Nov 6, 2024
33 checks passed
@alalazo alalazo deleted the hs/fix/find-error-handling branch November 6, 2024 10:49
@alalazo alalazo self-assigned this Nov 6, 2024
haampie added a commit that referenced this pull request Nov 7, 2024
scheibelp pushed a commit that referenced this pull request Nov 7, 2024
fryeguy52 pushed a commit to fryeguy52/spack that referenced this pull request Dec 17, 2024
fryeguy52 pushed a commit to fryeguy52/spack that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core PR affects Spack core functionality utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants