Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Support for renameat2?

Open
#406 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust

Research direction

Start with cap-std's Dir::rename and rustix::fs::renameat_with, then compare how filesystem operations are exposed across supported platforms. Read cap-std-ext's atomic-write implementation to understand the RENAME_NOREPLACE use case. Done means renameat2-style flags are supported where available and atomic creation can avoid overwriting an existing file.

Written by the indexing model from the issue text.

Description

On Linux, cap-std implements Dir::rename via rustix::fs::renameat, which is the renameat function.

Since Linux 3.15, there is another version of this call, renameat2, which supports an additional flags argument. rustix already supports this function as rustix::fs::renameat_with.

Could cap-std add support for this function as well?

Additional Context

The external cap-std-ext crate implements atomic writes by writing a temporary file and renaming it in place. However, it is not possible to atomically create a file in this way.

renameat2 supports the RENAME_NOREPLACE flag, which ensures that no existing file is overwritten by the rename. As such, an atomic_create could be implemented based on this change.

Dominant language
Rust
Stars
821
Forks
59
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bytecodealliance/cap-std

All issues in bytecodealliance/cap-std

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.