bug(partitions): a_removal_cut_short_leaves_the_marker_in_place panics when tests run as root

Cerrado
#4,753 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@coding-by-sea ya está trabajando en esto.

Desde el 4/11/2026.

  • #4754 de @coding-by-sea — fusionado

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug CI/CD
Bug description

partition_storage::tests::a_removal_cut_short_leaves_the_marker_in_place panics when the partitions tests run as root, for example in a Docker container. I expected it to return early, as its comment says: "Root ignores the mode, so nothing would cut the removal short."

The test makes offsets/ read-only (0o500) so that remove_partition_dir stops partway. Root ignores the mode, so the probe remove_file succeeds, blocked is false, and remove_partition_dir deletes the whole directory. The next line restores the mode on offsets, which no longer exists, and its unwrap() panics before the if !blocked check:

let blocked = std::fs::remove_file(offsets.join("1")).is_err();

let result = remove_partition_dir(partition_dir).await;
std::fs::set_permissions(&offsets, Permissions::from_mode(mode)).unwrap(); // NotFound as root
if !blocked {
    return;
}

partition_storage.rs#L1106-L1112, added in #4365. CI runs as a non-root user, so it never hits this. As root, the failure also stops cargo test -p partitions before the crate's integration tests run.

Possible fix: return before remove_partition_dir when the probe shows the mode is ignored.

let blocked = std::fs::remove_file(offsets.join("1")).is_err();
if !blocked {
    std::fs::set_permissions(&offsets, Permissions::from_mode(mode)).unwrap();
    return;
}

let result = remove_partition_dir(partition_dir).await;
std::fs::set_permissions(&offsets, Permissions::from_mode(mode)).unwrap();

Found while running the tests in a Linux container with an AI assistant.

Affected area / component

CI / build / tooling

Deployment

Not applicable

Versions

master at d0fc19a (Nov 4, 2026)

Hardware / environment

Docker Desktop on an Apple silicon Mac, rust:1.99.1-slim-trixie container running as root, kernel 7.0.14-linuxkit

Sample code

No response

Logs

thread 'partition_storage::tests::a_removal_cut_short_leaves_the_marker_in_place' panicked at core/partitions/src/partition_storage.rs:1109:74:
called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" }

Iggy server config

No response

Reproduction

From the repository root (the container runs as root by default):

docker run --rm --security-opt seccomp=unconfined \
  -v "$PWD":/iggy -w /iggy -e CARGO_TARGET_DIR=/tmp/target \
  rust:1.99.1-slim-trixie \
  cargo test --locked -p partitions --lib -- \
  partition_storage::tests::a_removal_cut_short_leaves_the_marker_in_place --exact

seccomp=unconfined lets compio use io_uring. Without it, every compio test fails earlier with "cannot create runtime". The test passes when the same suite runs as a non-root user.

Contribution
  • I'm willing to submit a pull request to fix this bug
Good first issue
  • I think this could be a good first issue for a new contributor
Lenguaje dominante
Rust
Estrellas
5.2k
Forks
502
Merge medio
3 d 3 h
PR fusionados (30 d)
163

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/iggy

Todos los issues de apache/iggy

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.