bytecodealliance / bytecodealliance/cap-std
Support for renameat2?
- 主要言語
- Rust
- スター
- 821
- フォーク
- 57
- 平均マージ
- 1時間 16分
- マージ済み PR(30日)
- 4
説明
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.
コントリビューションガイド
調査の方向性
まず cap-std の Dir::rename と rustix::fs::renameat_with から始め、サポート対象プラットフォーム全体でファイルシステム操作がどのように公開されているかを比較します。RENAME_NOREPLACE のユースケースを理解するため、cap-std-ext の atomic-write 実装を読みます。renameat2 スタイルのフラグが利用可能な環境でサポートされ、アトミックな作成によって既存のファイルの上書きを回避できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- operating-systems
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100