GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix stat module compilation for Redox OS by willnode · Pull Request #5857 · RustPython/RustPython

Conversation

@willnode

@willnode willnode commented Jun 28, 2025 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #5856

The replacement constants is exist for redox and should be working: https://github.com/rust-lang/libc/blob/main/src/unix/redox/mod.rs

Summary by CodeRabbit

  • Bug Fixes
    • Corrected permissions constants to ensure accurate values are used on Redox OS. This improves compatibility and reliability for users on that platform.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

moreal reacted with eyes emoji
All reactions
  • 👀 1 reaction
@willnode
Fix stat module compilation for Redox OS
02eb1bd
@coderabbitai

coderabbitai Bot commented Jun 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Walkthrough

The conditional compilation logic for the S_IWRITE and S_IEXEC constants in stat.rs was updated to explicitly exclude the Redox operating system from the Unix-specific branch. This ensures that Redox uses fallback octal values for these constants instead of relying on potentially unavailable libc values.

Changes

File(s) Change Summary
vm/src/stdlib/stat.rs Updated conditional compilation for S_IWRITE and S_IEXEC to exclude Redox from Unix branch.

Sequence Diagram(s)

sequenceDiagram
    participant RustPython
    participant OS

    RustPython->>OS: Detect target_os
    alt Unix and not Android and not Redox
        RustPython->>stat.rs: Use libc S_IWRITE/S_IEXEC
    else Android or not Unix or Redox
        RustPython->>stat.rs: Use fallback octal values (0o0200, 0o0100)
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Avoid use of obsolete S_IWRITE and S_IEXEC on Redox OS (#5856) ✅
Ensure Redox uses fallback values for S_IWRITE and S_IEXEC (#5856) ✅

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found.

Poem

In the warren where the code does grow,
A Redox rabbit hopped to and fro.
"No more old constants!" it did decree,
Now octal values set us free.
With every hop, a bug erased—
RustPython’s stat is now well-placed!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2bd5212 and 02eb1bd.

📒 Files selected for processing (1)
  • vm/src/stdlib/stat.rs (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: moreal
PR: RustPython/RustPython#5847
File: vm/src/stdlib/stat.rs:547-567
Timestamp: 2025-06-27T14:47:28.770Z
Learning: In RustPython's stat module implementation, platform-specific constants like SF_SUPPORTED and SF_SYNTHETIC should be conditionally declared only for the platforms where they're available (e.g., macOS), following CPython's approach of optional declaration using #ifdef checks rather than providing fallback values for other platforms.
Learnt from: moreal
PR: RustPython/RustPython#5847
File: vm/src/stdlib/stat.rs:547-567
Timestamp: 2025-06-27T14:47:28.770Z
Learning: In RustPython's stat module implementation, platform-specific constants like SF_SUPPORTED and SF_SYNTHETIC should be conditionally declared only for the platforms where they're available (e.g., macOS), following CPython's approach of optional declaration rather than providing fallback values for other platforms.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
vm/src/stdlib/stat.rs (3)
Learnt from: moreal
PR: RustPython/RustPython#5847
File: vm/src/stdlib/stat.rs:547-567
Timestamp: 2025-06-27T14:47:28.770Z
Learning: In RustPython's stat module implementation, platform-specific constants like SF_SUPPORTED and SF_SYNTHETIC should be conditionally declared only for the platforms where they're available (e.g., macOS), following CPython's approach of optional declaration using #ifdef checks rather than providing fallback values for other platforms.
Learnt from: moreal
PR: RustPython/RustPython#5847
File: vm/src/stdlib/stat.rs:547-567
Timestamp: 2025-06-27T14:47:28.770Z
Learning: In RustPython's stat module implementation, platform-specific constants like SF_SUPPORTED and SF_SYNTHETIC should be conditionally declared only for the platforms where they're available (e.g., macOS), following CPython's approach of optional declaration rather than providing fallback values for other platforms.
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-26T12:52:11.109Z
Learning: Minimize modifications to CPython standard library files in the Lib/ directory; bug fixes should be made through Rust code modifications whenever possible.
🔇 Additional comments (2)
vm/src/stdlib/stat.rs (2)

135-140: Redox correctly excluded for S_IWRITE – change is sound

libc on Redox does not expose S_IWRITE, so falling back to the octal literal is the right fix and mirrors what we already do for Android. No functional or stylistic issues spotted.


149-154: Same-pattern fix for S_IEXEC looks good

Consistent with the previous hunk: Redox now uses the fallback value because libc lacks S_IEXEC. Implementation matches CPython behaviour for platforms without the constant.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rw-vanc

rw-vanc commented Jun 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

We probably need to fix S_IREAD as well.

I'm not entirely sure why S_IWRITE and S_IEXEC would be needed, but I think you should avoid them if you can.

And why are S_IRUSR, S_IWUSR and S_IXUSR all defined numerically (no libc::) but S_IREAD, S_IWRITE and S_IEXEC are defined using libc:: which will break on many Unixes. Why not define them in terms of S_IRUSR, S_IWUSR, and S_IXUSR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

moreal
moreal approved these changes Jun 28, 2025
View reviewed changes
@willnode

willnode commented Jun 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@rw-vanc

I'm not quite understand about pub const S_IWRITE and S_IEXEC is used in the codebase so I'm just following along. The definition for S_IRUSR, S_IWUSR, and S_IXUSR is already exist in above of my changes and AFAIK redox is part of unix so no need changes in that part.

The python constants is already using Unix V7 synonym though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rw-vanc

rw-vanc commented Jun 28, 2025

Copy link
Copy Markdown

Yes, I reviewed the original code a little more, and I think a better fix would be to just define S_IREAD, S_IWRITE and S_IEXEC either in terms of S_IRUSR, S_IWUSR and S_IXUSR, or define them numerically always, as was done for the S_I{R,W,X}USR constants.

willnode reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone

youknowone commented Jun 28, 2025

Copy link
Copy Markdown
Member

Thank you! We currently disabled redox CI due to broken github action

https://github.com/RustPython/RustPython/blob/main/.github/workflows/ci.yaml#L226-L232

Could someone help to fix it? Then this kind of breakage will be prevented

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

youknowone
youknowone approved these changes Jun 28, 2025
View reviewed changes
@willnode

willnode commented Jun 28, 2025

Copy link
Copy Markdown
Contributor Author

I wish I can but currently redoxer itself is broken against recent kernel and the current CI always uses the new kernel. We'll figure out a way to fix it. Thanks for mentioning the CI 👍

youknowone and arihant2math reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone merged commit e41d7f5 into RustPython:main Jun 28, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jul 22, 2025
Cleanup vm/src/stdlib/stat.rs #6018
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes
@moreal moreal moreal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

S_IWRITE and S_IEXEC are obsolete and break RustPython on Redox

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@willnode @rw-vanc @youknowone @moreal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.