decodeListing reports truncated listings as errors on Go 1.27

Aperta
#120 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@CJstate ci sta già lavorando.

Dal 4/12/2026.

  • #122 di @CJstate — aperta

Valutazione

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

Direzione di ricerca

Read internal/files/lister.go around decodeListing at line 459 and the TestDecodeListingByteCap case in decode_internal_test.go. Reproduce the behavior with the Go versions described in the issue, then check how reaching the byte cap affects decode errors. Done when the test treats a capped listing as truncated without returning the unexpected end of JSON input error.

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

Descrizione

TestDecodeListingByteCap fails on Go 1.27 and passes on the pinned toolchain (go1.26.11), so main is fine today and this will break when the toolchain moves.

--- FAIL: TestDecodeListingByteCap/entry_boundary
    decode_internal_test.go:29: got 1 entries, truncated false, err unexpected end of JSON input

decodeListing treats a cut-off body as truncated only when the error is io.EOF or io.ErrUnexpectedEOF (internal/files/lister.go:459). On Go 1.27, encoding/json's Decoder reports running out of input as *json.SyntaxError "unexpected end of JSON input", and More() returns true at that point instead of false. A small probe reading {"list":[{"Name":"a"} and then calling Token():

go1.26.11: More: false  Token: *errors.errorString EOF
go1.27.4:  More: true   Token: *json.SyntaxError unexpected end of JSON input

So a listing that hits the byte cap comes back as an error instead of a truncated listing. Since lr.N <= 0 already says the cap was hit, the fix could be to treat any decode error after the limit is reached as truncation, rather than matching on the error type.

I hit this because my machine runs with GOTOOLCHAIN=local, so the toolchain line was ignored.

Lingua principale
Go
Stelle
5
Fork
0
Merge medio
21h 13m
PR unite (30g)
53

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 nebari-dev/tapas

Tutte le issue di nebari-dev/tapas

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.