bytecodealliance / bytecodealliance/cap-std

Support for renameat2?

Abierto
#406 1 comentario 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
821
Forks
57
Merge medio
1 h 16 min
PR fusionados (30 d)
4

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
operating-systems
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.