decodeListing reports truncated listings as errors on Go 1.27

Đang mở
#120 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@CJstate đang làm issue này rồi.

Từ ngày 4/12/2026.

  • #122 của @CJstate — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Go
Star
5
Fork
0
Merge trung bình
21 giờ 13 phút
Pull request đã merge (30 ngày)
53

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nebari-dev/tapas

Tất cả issue của nebari-dev/tapas

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.