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

image prune: --filter until= with an empty value is ignored and prunes every unused image

Aperta
#5,303 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@ogulcanaydogan ci sta già lavorando.

Dal 28/10/2026.

  • #5304 di @ogulcanaydogan — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
go
Ambito
cli, testing

Direzione di ricerca

Start with pkg/imgutil/filtering.go and the reported ParseFilters check, then read TestFilterUntil and the parsing tests. The issue reports an open linked pull request (#5304), so work is already underway. Done means ParseFilters([]string{"until="}) returns the expected “no until timestamp provided” error.

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

Descrizione

Description

imgutil.ParseFilters accepts until= with an empty value, and nerdctl image prune then ignores the filter and prunes every image it would prune without a filter.

In pkg/imgutil/filtering.go the check for an empty timestamp looks at the filter name instead of the value, so it can never fail:

} else if tempFilterToken[0] == FilterUntilType {
	if len(tempFilterToken[0]) == 0 {   // tempFilterToken[0] is "until"
		return nil, errNoUntilTimestamp

f.Until stays empty, and pkg/cmd/image/prune.go only adds the until filter when len(parsedFilters.Until) > 0. So nerdctl image prune -a --filter until= removes all unused images (and without -a all dangling images) instead of returning no until timestamp provided, which is what FilterUntil("") and the existing TestFilterUntil expect. It also matters in scripts that build the value, for example --filter until=$(some-command) where the command prints nothing, together with --force.

I found this by reading the code and checked it with a unit test on ParseFilters, not by running nerdctl image prune against containerd.

Steps to reproduce the issue
_, err := imgutil.ParseFilters([]string{"until="})
// err is nil, errNoUntilTimestamp is expected

Or nerdctl image prune -a --force --filter until= on a host with unused images.

Describe the results you received and expected

Received: no error, and the unused images are removed as if no filter was given.
Expected: no until timestamp provided, and nothing is removed.

What version of nerdctl are you using?

main (5140812f)

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

No

Host information

macOS, go1.26.8 (the unit test does not need containerd)

Lingua principale
Go
Stelle
10.5k
Fork
839
Merge medio
3g 22h
PR unite (30g)
38

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

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 containerd/nerdctl

Tutte le issue di containerd/nerdctl

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.