image prune: --filter until= with an empty value is ignored and prunes every unused image
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di containerd/nerdctl
-
Test and examples: update wordpress images (to silence potential false security alerts)Forse di nuovo libera @ayushpratap27 l’ha presa 7 giorni fa e non c’è nessuna pull request aperta. Apertaarea/ci documentation priority/low
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
containerd/nerdctl#5283 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
`nerdctl kill` shouldn't set `containerd.io/restart.explicitly-stopped` label for non-stop signalsForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
containerd/nerdctl#5171 · 3 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
v2.4.2 planningApertaarea/project
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
containerd/nerdctl#5294 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
CI: migrate `ecr.aws` images to GHCR (to avoid the ECR rate limit)Forse già presa @mainguyen0112 l’ha presa 1 giorno fa. Apertaarea/ci priority/high
containerd/nerdctl#5293 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
nerdctl rm -f exits 0 when task deletion fails, so callers cannot detect a failed removalForse già presa @sarankumar1325 l’ha presa 5 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
containerd/nerdctl#5288 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di containerd/nerdctl
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
google/go-containerregistry#2491 ·
I maintainer di solito rispondono entro 1 giorno
-
aiac enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
phase:v1 type:harness
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
scttfrdmn/burroughs#1181 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
compiler-explorer/ce-ci#28 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno