Skip to content

fix: skip permission denied errors in recursive_directory_iterator#1564

Merged
leejet merged 1 commit into
leejet:masterfrom
schirik:master
May 26, 2026
Merged

fix: skip permission denied errors in recursive_directory_iterator#1564
leejet merged 1 commit into
leejet:masterfrom
schirik:master

Conversation

@schirik
Copy link
Copy Markdown
Contributor

@schirik schirik commented May 26, 2026

Summary

This PR prevents sdcpp-webui from error Service Unavailable when scanning directories with restricted system folders (like lost+found) by adding fs::directory_options::skip_permission_denied to the recursive_directory_iterator.

Additional Information

When lora_model_dir defaults to the current working directory (.) and the server is executed from specific directory, fs::recursive_directory_iterator attempts to scan system folders like lost+found.

Since regular users lack read permissions for these directories, the iterator throws a fatal std::filesystem::filesystem_error (Permission denied), resulting in an EXCEPTION_WHAT crash and partially breaking the web server routing (leading to Service Unavailable errors in the UI).

How to reproduce

  1. cd /
  2. Run sd-server as a non-root user
  3. Observe the Service Unavailable in web (filesystem error: cannot increment recursive directory iterator: Permission denied crash upon UI initialization).

@leejet leejet merged commit 07b2b18 into leejet:master May 26, 2026
@leejet
Copy link
Copy Markdown
Owner

leejet commented May 26, 2026

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants