Update libc to 0.2.182#7247
Conversation
📝 WalkthroughWalkthroughBumps the libc dependency, reorganizes and expands per-target libc symbol imports and cfg gating in the POSIX module, and replaces the hardcoded const-generation script with a TOML-driven, multi-target extraction pipeline that fetches upstream docs and formats generated Rust. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer / CI
participant Script as scripts/libc_posix.py
participant Cargo as Cargo.toml
participant Remote as Upstream Docs
participant Rustfmt as rustfmt
participant Out as Generated Rust (posix.rs)
Dev->>Script: invoke generation
Script->>Cargo: read libc version from Cargo.toml
Script->>Remote: fetch source pages for each TARGET
Remote-->>Script: return HTML/text
Script->>Script: extract constants, group by Cfg/Target, attach extras
Script->>Rustfmt: format generated Rust code
Rustfmt-->>Script: return formatted code
Script->>Out: write cfg-tagged Rust blocks into posix.rs
Script-->>Dev: exit (success or error)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Sorry, something went wrong.
|
Code has been automatically formatted The code in this PR has been formatted using:
git pull origin update-libc-0-2-182 |
Sorry, something went wrong.
123b629 to
5248d83
Compare
February 28, 2026 18:14
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/vm/src/stdlib/posix.rs`:
- Around line 64-66: The cfg currently gating SCHED_DEADLINE and SCHED_NORMAL is
too narrow (only Android); change the attribute on the use/import of
SCHED_DEADLINE and SCHED_NORMAL in posix.rs from #[cfg(target_os = "android")]
to #[cfg(any(target_os = "android", target_os = "linux"))] so these constants
are available on Linux as well (match the pattern used for
SCHED_BATCH/SCHED_IDLE/SCHED_RESET_ON_FORK); update the cfg on the import that
references SCHED_DEADLINE and SCHED_NORMAL accordingly.
ℹ️ Review info
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
Cargo.tomlcrates/vm/src/stdlib/posix.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- Cargo.toml
Sorry, something went wrong.
8f895d3 to
2979d36
Compare
March 3, 2026 15:38
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/libc_posix.py (1)
20-20: Use explicit UTF-8 when readingCargo.toml.Line 20 currently relies on platform default encoding; specifying UTF-8 avoids locale-dependent failures.
Proposed fix
-CARGO_TOML = tomllib.loads(CARGO_TOML_FILE.read_text()) +CARGO_TOML = tomllib.loads(CARGO_TOML_FILE.read_text(encoding="utf-8"))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/libc_posix.py` at line 20, The code reads Cargo.toml using CARGO_TOML_FILE.read_text() which uses the platform default encoding; change the read to explicitly use UTF-8 so parsing is deterministic by calling read_text with encoding="utf-8" (or open the file with encoding="utf-8" and pass the content to tomllib.loads) and assign the result back to CARGO_TOML; update the CARGO_TOML assignment that references CARGO_TOML_FILE to use the UTF-8-decoded text.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/libc_posix.py`:
- Around line 163-165: The return type annotation of consts_from_url is
incorrect (currently "str") — update its annotation to match the actual returned
type from extract_consts, e.g. change the function signature to return
frozenset[str] (or typing.FrozenSet[str] if using typing imports) so it aligns
with CONSTS_PATTERN, EXCLUDE, and the extract_consts(...) return value used in
the implementation.
---
Nitpick comments:
In `@scripts/libc_posix.py`:
- Line 20: The code reads Cargo.toml using CARGO_TOML_FILE.read_text() which
uses the platform default encoding; change the read to explicitly use UTF-8 so
parsing is deterministic by calling read_text with encoding="utf-8" (or open the
file with encoding="utf-8" and pass the content to tomllib.loads) and assign the
result back to CARGO_TOML; update the CARGO_TOML assignment that references
CARGO_TOML_FILE to use the UTF-8-decoded text.
ℹ️ Review info
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
Cargo.tomlcrates/vm/src/stdlib/posix.rsscripts/libc_posix.py
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/libc_posix.py (1)
235-235: Make import rendering deterministic before formatting.Line 235 joins a
setdirectly. Sorting here avoids nondeterministic intermediate output and avoids relying on formatter behavior for stable ordering.Proposed fix
- imports = ",".join(consts) + imports = ",".join(sorted(consts))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/libc_posix.py` at line 235, The current code constructs imports by joining consts directly which can be nondeterministic if consts is a set; make the output deterministic by sorting before joining — replace the join over consts with a join over sorted(consts) so the variable imports is produced in stable, alphabetical order (referencing the consts collection and the imports variable).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/libc_posix.py`:
- Around line 179-184: The Python helper libc_posix.py calls
urllib.request.urlopen(url) without a timeout; since Python code should remain
unchanged, enforce a request timeout in the Rust caller that invokes this
script: locate the Rust code that spawns or invokes libc_posix.py (the
Command/process that passes the `url` to libc_posix.py) and wrap the child
process execution with a timeout (e.g., use std::process::Child + wait_timeout
crate or tokio::time::timeout for async) so the Python helper is killed if it
hangs, return a clear error to the caller; ensure the timeout value is
configurable or documented and that the child process is terminated (kill) on
timeout and proper errors are propagated to the calling code.
---
Nitpick comments:
In `@scripts/libc_posix.py`:
- Line 235: The current code constructs imports by joining consts directly which
can be nondeterministic if consts is a set; make the output deterministic by
sorting before joining — replace the join over consts with a join over
sorted(consts) so the variable imports is produced in stable, alphabetical order
(referencing the consts collection and the imports variable).
Sorry, something went wrong.
798f9e8
into
RustPython:main
Mar 4, 2026
* Update to libc 0.2.182, refactor update script * Fix typing
Summary by CodeRabbit