Skip to content

startup: Skip unreadable database search directories - #8070

Merged
cwhite911 merged 8 commits into
OSGeo:mainfrom
NIne-WIngEd:fix/startup-unreadable-directories-8027
Dec 5, 2026
Merged

cwhite911 merged 8 commits into
OSGeo:mainfrom
NIne-WIngEd:fix/startup-unreadable-directories-8027

Conversation

@NIne-WIngEd

Copy link
Copy Markdown
Contributor

GRASS now skips unreadable directories instead of crashing at startup. The existing search order and fallback stay the same.

Added tests for permission errors and database discovery.

Fixes #8027

Refs OSGeo#8027. No source or test changes.

AI assistance was used for the issue analysis and draft.
@github-actions github-actions Bot added Python Related code is in Python libraries tests Related to Test Suite labels Oct 14, 2026
@NIne-WIngEd NIne-WIngEd changed the title app: Skip unreadable database search directories startup: Skip unreadable database search directories Oct 14, 2026
@NIne-WIngEd

Copy link
Copy Markdown
Contributor Author

Hi, just following up on this PR. The checks are passing now. Could you review and merge it if everything looks good? Happy to make any changes needed. Thanks!

@cwhite911 cwhite911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I've suggested a few minor improvements, but otherwise this looks good to me.

Comment thread python/grass/app/data.py Resolved
@NIne-WIngEd

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I replaced the nested try/except blocks with contextlib.suppress. The unreadable-directory test now checks only PermissionError. I also changed deny_listing to patch Path.iterdir directly instead of os.scandir and os.listdir.

Comment thread python/grass/app/data.py Resolved

@cwhite911 cwhite911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

AI picked up two other issues that could be continued as follow up PRs. See details below.

Details Two minor points, neither blocking:
  1. Folder choice can be arbitrary (data.py:44, an old problem the PR keeps). Any folder whose name contains "grassdata" counts as a match, and the first one listed wins. If both ~/grassdata and ~/grassdata_old_backup exist, which one is suggested depends on the order the filesystem lists them. The new test has to sort the entries to get a stable result, which shows the problem. A follow-up fix would prefer an exact, case-insensitive grassdata match, then fall back to partial matches in sorted order.
  2. An error partway through a listing skips the rest of that folder (data.py:49). The except OSError: continue wraps the whole loop over a folder's contents. If an I/O error happens before the grassdata entry is reached (say, on a network-mounted home folder), the match is missed. This is probably fine because a failed listing usually can't be resumed, but a short comment noting the limit would help.

@cwhite911
cwhite911 enabled auto-merge (squash) December 4, 2026 22:27
@cwhite911
cwhite911 merged commit efe0d58 into OSGeo:main Dec 5, 2026
27 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries Python Related code is in Python tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] macOS: Startup crashes with StopIteration when ~/Documents is not readable (macOS privacy protection)

2 participants