-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
bugSomething isn't workingSomething isn't workingpriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
Description
Describe the bug
Using pr diff on a PR that happened to include some very long lines (~139 kB, displays in the web viewer as "large diff" by default & does not render), I encountered a crash:
error reading pull request diff: bufio.Scanner: token too long
The output was correct (comparing with the web PR viewer) up to the first very long line.
Piping the output to an external program (e.g. less) averts the crash, but passing the --color always option brings it back.
Steps to reproduce the behavior
- Run
gh pr diffproviding a PR that includes a diff with very long lines - See error
- Try e.g.
gh pr diff --color never | less - See no error
- Try e.g.
gh pr diff --color always | less -R - See error
Expected vs actual behavior
Either the long lines should be truncated, the diff should not be displayed (by default?), as in the web viewer, or the lines should be displayed in full. In any case, no error should be generated.
This looks like it's a result of using bufio.Scanner, which has a default buffer limit of 64 kB:
Line 116 in d794a92
| diffLines := bufio.NewScanner(diff) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic