Skip to content

uucore: for fs use real inode dev stat on wasi - #13684

Open
eduardomourar wants to merge 1 commit into
uutils:mainfrom
eduardomourar:wasi-fs-inode-dev-stat
Open

eduardomourar wants to merge 1 commit into
uutils:mainfrom
eduardomourar:wasi-fs-inode-dev-stat

Conversation

@eduardomourar

Copy link
Copy Markdown
Contributor

FileInformation previously fell back to a std::fs::Metadata-based heuristic (comparing file type and size) on WASI, since it lacked access to nix::sys::stat. Switch it to rustix::fs::Stat, the same backing type used on Unix, giving WASI real inode/device identity, nlink, and equality checks instead of an approximation. Also add WASI implementations of are_hardlinks_to_same_file and are_hardlinks_or_one_way_symlink_to_same_file via rustix::fs::stat/ lstat, since std::os::unix::fs::MetadataExt is unavailable there.

@codspeed

codspeed Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 18.85%

1 warning, 1 note

⚠️ 119 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

⚡ 1 improved benchmark
✅ 400 untouched benchmarks
⏩ 70 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation true_consecutive_calls 350.2 ns 294.7 ns +18.85%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing eduardomourar:wasi-fs-inode-dev-stat (7d5286e) with main (679d1f2)2

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (eb7d426) during the generation of this report, so 679d1f2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/dd/nocache_fail is now passing!
Note: The gnu test tests/rm/rm-readdir-fail was skipped on 'main' but is now failing.

@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch from 7425df9 to ab6642b Compare August 1, 2026 12:43
@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch 2 times, most recently from 3d8f91e to 2d8d677 Compare August 11, 2026 20:09
@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch 4 times, most recently from d880271 to d5437e3 Compare September 8, 2026 13:35
@eduardomourar

Copy link
Copy Markdown
Contributor Author

@sylvestre, this one is ready (now with proper testing in place).

@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch 2 times, most recently from 2dcd55b to 106a29b Compare September 15, 2026 08:14
Comment thread src/uucore/src/lib/features/fs.rs Outdated
Comment thread src/uucore/src/lib/features/fs.rs Outdated
Comment thread src/uucore/src/lib/features/fs.rs
Comment thread tests/by-util/test_comm.rs Outdated
@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch 2 times, most recently from 16bc926 to d7de947 Compare September 28, 2026 21:58
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks, this looks much better: there's one rustix impl shared by unix and wasi now, the target-first early return is still there, and the tests run on wasi too. One nit left: the comment in fsext/mod.rs:142 can just be // ctime isn't exposed by std Metadata outside unix. Also, does any CI job actually run the uucore tests on wasi? If not, the new wasi cfgs are still untested.

@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch from d7de947 to d0fad40 Compare October 6, 2026 21:53
@eduardomourar

Copy link
Copy Markdown
Contributor Author

Done. Added a step to wasi.yml in order to run the unit tests for uucore.

@sylvestre
sylvestre force-pushed the wasi-fs-inode-dev-stat branch from d0fad40 to a7880bd Compare October 8, 2026 13:38
@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch from a7880bd to be1501f Compare October 8, 2026 19:39
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks, this looks much better: One nit left: the comment in fsext/mod.rs:142 can just be // ctime isn't exposed by std Metadata outside unix.
Also, does any CI job actually run the uucore tests on wasi? If not, the new wasi cfgs are still untested.

@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch from 2e470fd to 3e879a6 Compare October 16, 2026 10:55
Comment thread src/uucore/src/lib/features/fs.rs Outdated
@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch from 3e879a6 to 288953f Compare October 17, 2026 13:42
@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch 3 times, most recently from 4f94318 to 74fcbf3 Compare October 22, 2026 01:18
@eduardomourar
eduardomourar force-pushed the wasi-fs-inode-dev-stat branch from 74fcbf3 to 7d5286e Compare October 22, 2026 09:17

This branch has not been deployed

No deployments
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.

2 participants