Skip to content

host_env: os.mkdir for Windows, Redox#8128

Open
joshuamegnauth54 wants to merge 1 commit into
RustPython:mainfrom
joshuamegnauth54:host_env-mkdir
Open

host_env: os.mkdir for Windows, Redox#8128
joshuamegnauth54 wants to merge 1 commit into
RustPython:mainfrom
joshuamegnauth54:host_env-mkdir

Conversation

@joshuamegnauth54

@joshuamegnauth54 joshuamegnauth54 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Python supports mkdir on Windows. I deferred to calling Rust's implementation for now. However, like rename, Python's implementation supports additional features that are currently unsupported on RustPython. I added a note for future reference.

Redox supports mkdirat which significantly cleans up the implementation.

Summary

  • Windows support for os.mkdir
  • Deduplicate Unix implementation

On a related note, I think the WASI Posix and Unix implementations can be combined eventually. 🤔

Summary by CodeRabbit

  • Refactor
    • Unified directory creation interface across platforms for improved consistency and maintainability.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/host_env/src/posix_wasi.rs`:
- Around line 4-10: The make_dir function uses &Path as a parameter type, but
Path is not imported from the standard library, causing a compilation error. Add
path::Path to the existing std imports at the top of the file where ffi::OsStr
and io are already imported to bring Path into scope.

In `@crates/vm/src/stdlib/os.rs`:
- Line 191: The MKDIR_DIR_FD constant in the os.rs file is currently configured
only for unix systems using cfg!(unix), but since WASI now supports the optional
dir_fd parameter in make_dir function as implemented in posix_wasi.rs, the cfg
condition needs to be updated. Modify the MKDIR_DIR_FD constant definition to
also include WASI targets in the condition so that dir_fd functionality is
enabled on WASI systems where it is now supported.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 9e70d5e8-58e8-4b98-9525-1ee325ec8978

📥 Commits

Reviewing files that changed from the base of the PR and between fe2a7db and 9e4a98a.

📒 Files selected for processing (3)
  • crates/host_env/src/posix.rs
  • crates/host_env/src/posix_wasi.rs
  • crates/vm/src/stdlib/os.rs

Comment thread crates/host_env/src/posix_wasi.rs Outdated
Comment thread crates/vm/src/stdlib/os.rs Outdated
@joshuamegnauth54 joshuamegnauth54 marked this pull request as draft June 18, 2026 01:27
@joshuamegnauth54 joshuamegnauth54 force-pushed the host_env-mkdir branch 6 times, most recently from 2d1b1cd to eb71c5c Compare June 24, 2026 01:36
@joshuamegnauth54 joshuamegnauth54 force-pushed the host_env-mkdir branch 4 times, most recently from 4ebd815 to 4150ef9 Compare June 29, 2026 02:49
Python supports `mkdir` on Windows. I deferred to calling Rust's
implementation for now. However, like `rename`, Python's implementation
supports additional features that are currently unsupported on
RustPython. I added a note for future reference.

Redox supports `mkdirat` which significantly cleans up the
implementation.
@joshuamegnauth54 joshuamegnauth54 marked this pull request as ready for review June 29, 2026 04:45
@joshuamegnauth54

Copy link
Copy Markdown
Contributor Author

test_ssl failed in CI last time I pushed but it passes locally. 🤔 I didn't change anything that would touch SSL, so it may be a spurious GitHub failure.

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.

1 participant