Profile import fails with EOF error for valid .bpf files since v1.13.0
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 131
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
Importing a valid .bpf profile file fails with "Failed to import profile from URL EOF" since sing-box for android v1.13.0. Files exported by the app itself import fine, but files generated externally (e.g. by a script using standard gzip) may fail, even though the binary format is identical and correct.
The root cause is in StubReader.ReadByte() (common/varbin/data_if.go) — it ignores the n return value from Read(), discarding a successfully read byte when Read() returns data together with EOF, which is valid per the io.Reader contract. Whether the bug triggers depends on the internal structure of the gzip stream produced by the encoder.
The issue was exposed by commit SagerNet/sing-box@1af14a0, which replaced io.ReadFull() with byte-by-byte ReadByte() in readString().
Fix: #98
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in common/varbin/data_if.go at StubReader.ReadByte(), then review the io.Reader contract and the readString() change referenced in commit 1af14a0. Reproduce the failure with a valid externally generated .bpf file and verify that both externally generated and app-exported profiles import successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100