Skip to content

fix(policy): handle OSError from is_file() on macOS PATH_MAX limit#860

Open
chaobo8484 wants to merge 1 commit intomicrosoft:mainfrom
chaobo8484:fix/issue-848-macos-path-max-crash
Open

fix(policy): handle OSError from is_file() on macOS PATH_MAX limit#860
chaobo8484 wants to merge 1 commit intomicrosoft:mainfrom
chaobo8484:fix/issue-848-macos-path-max-crash

Conversation

@chaobo8484
Copy link
Copy Markdown

@chaobo8484 chaobo8484 commented Apr 23, 2026

When load_policy() receives a YAML string that exceeds ~1023 bytes, the is_file() syscall fails on macOS (PATH_MAX ≈ 1024) with OSError [Errno 63] File name too long. Wrap the call in try/except to gracefully fall back to treating the input as a YAML string.

Fixes #848

Description

Brief description of changes and motivation.

Fixes # (issue)

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

When load_policy() receives a YAML string that exceeds ~1023 bytes,
the is_file() syscall fails on macOS (PATH_MAX ≈ 1024) with
OSError [Errno 63] File name too long. Wrap the call in try/except
to gracefully fall back to treating the input as a YAML string.

Fixes microsoft#848
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.

policy: load_policy() raises OSError on macOS when policy YAML > 1023 bytes

1 participant