Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

filecache: TestGetFileToPublishedCopyIsWriteProtected fails when tests run as root

Aperta Adatta ai principianti
#2,704 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #2703 di @cloudonly — chiusa senza merge

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
testing

Direzione di ricerca

Il test che fallisce è TestGetFileToPublishedCopyIsWriteProtected nel pacchetto filecache. Controlla come i test fratelli TestEvictUnusedRemovalFailureIsNotCountedFreed e TestEvictUnusedRetireFailureIsNotCountedFreed vengono saltati quando os.Geteuid() è 0, e aggiungi la stessa protezione. Il lavoro è completo quando il test viene saltato sotto root e continua a passare se eseguito da un utente senza privilegi. La issue #2703 è indicata come correzione, quindi verifica che non sia già in corso prima di iniziare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
5.7k
Fork
612
Merge medio
2g 14h
PR unite (30g)
533

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di agent-substrate/substrate

Tutte le issue di agent-substrate/substrate

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.