Skip to content

fix(fs): throw opendir errors for invalid paths#2965

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-2943-opendir-sync-errors
May 30, 2026
Merged

fix(fs): throw opendir errors for invalid paths#2965
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-2943-opendir-sync-errors

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

  • validate fs.opendirSync() path arguments before decoding
  • surface read_dir failures as Node-shaped opendir fs errors instead of returning empty Dir objects
  • route callback fs.opendir() through the same helper so regular-file paths callback with ENOTDIR
  • add focused parity coverage for missing dirs, regular files, invalid path values, and valid opendir behavior

Closes #2943.

Tests

  • PATH=/home/github-runner/actions-runner/externals/node24/bin:$PATH node --experimental-strip-types test-parity/node-suite/fs/readdir/opendir-invalid-paths.ts
  • Pre-fix focused parity failed with opendirSync missing no-throw true: test-parity/reports/parity_report_20260530_033305.json
  • PATH=/home/github-runner/actions-runner/externals/node24/bin:$PATH RUSTC_WRAPPER= ./run_parity_tests.sh --suite node-suite --module fs/readdir --filter opendir
  • cargo fmt --all -- --check
  • jq empty test-parity/known_failures.json test-parity/threshold.json
  • git diff --check && git diff --cached --check
  • ./scripts/check_file_size.sh
  • RUSTC_WRAPPER= cargo check -p perry-runtime

@proggeramlug proggeramlug merged commit 6349571 into PerryTS:main May 30, 2026
11 checks passed
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.

node:fs: throw from opendirSync on invalid directory paths

2 participants