Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

filecache: TestGetFileToPublishedCopyIsWriteProtected fails when tests run as root

Abierto Apto para principiantes
#2,704 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #2703 de @cloudonly — cerrado sin fusionar

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
testing

Línea de trabajo

La prueba que falla es TestGetFileToPublishedCopyIsWriteProtected en el paquete filecache. Revisa cómo las pruebas hermanas TestEvictUnusedRemovalFailureIsNotCountedFreed y TestEvictUnusedRetireFailureIsNotCountedFreed se omiten cuando os.Geteuid() es 0, y añade la misma protección. Se considera terminado cuando la prueba se omite como root y sigue pasando cuando se ejecuta como usuario sin privilegios. El issue #2703 se menciona como la corrección, así que confirma que no esté ya en curso antes de empezar.

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

Descripción

area/storage area/tests kind/bug

TestGetFileToPublishedCopyIsWriteProtected asserts that a write through the consumer's hard link to a published cache entry fails. That depends on the published copy's mode bits, which root ignores, so the write succeeds and the test fails even though the tripwire is intact.

The sibling tests that depend on the same property already skip in this case (TestEvictUnusedRemovalFailureIsNotCountedFreed and TestEvictUnusedRetireFailureIsNotCountedFreed in the same package, plus the permission-sensitive tests in cmd/atelet). This one was missed.

GitHub Actions runs the unit tests as the unprivileged runner user, so CI stays green. The failure shows up anywhere go test runs as root: a root developer machine, or the common case of running the tests inside a container image that defaults to root.

The proposed fix is the same three-line os.Geteuid() == 0 skip the sibling tests use. I verified it on a Linux host: the test is skipped as root, and it still passes (the write is rejected) when run as an unprivileged user.

Fix: #2703

Lenguaje dominante
Go
Estrellas
5k
Forks
563
Merge medio
2 d 15 h
PR fusionados (30 d)
457

Preparar el entorno

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 agent-substrate/substrate

Todos los issues de agent-substrate/substrate

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.