diffplug / diffplug/spotless

Protobuf/Buf Formatter Fails for Files Larger than 64KiB

Open
#2,481 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
559
Avg merge
1d 13h
Merged PRs (30d)
34

Description

Test case:

1. Define a .proto files larger than 64 KiB (or your platform's pipe buffer limit). Padding with whitespace should also work.
2. Configure spotless to format said file.
3. Run spotlessApply (gradle example).

Expected behavior:

Formatting runs and passes (if valid proto file).

Actual behavior:

```
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':treatment:api:spotlessProtobufApply'.
...
Caused by: org.gradle.api.GradleException: There were 1 lint error(s), they must be fixed or suppressed.
src/...:LINE_UNDEFINED buf(java.io.IOException) Broken pipe (...)
Resolve these lints or suppress with `suppressLintsFor`
at com.diffplug.gradle.spotless.SpotlessApply.performAction(SpotlessApply.java:60)
```

`cat`-ing `/build/spotless-lints/...` shows:
```
Broken pipe
at java.base/java.io.FileOutputStream.writeBytes(Native Method)
at java.base/java.io.FileOutputStream.write(FileOutputStream.java:367)
at java.base/java.io.BufferedOutputStream.implWrite(BufferedOutputStream.java:217)
at java.base/java.io.BufferedOutputStream.write(BufferedOutputStream.java:206)
at java.base/java.io.FilterOutputStream.write(FilterOutputStream.java:110)
at com.diffplug.spotless.ProcessRunner.start(ProcessRunner.java:165)
at com.diffplug.spotless.ProcessRunner.start(ProcessRunner.java:131)
at com.diffplug.spotless.ProcessRunner.exec(ProcessRunner.java:114)
at com.diffplug.spotless.ProcessRunner.exec(ProcessRunner.java:109)
at com.diffplug.spotless.protobuf.BufStep$State.format(BufStep.java:109)
at com.diffplug.spotless.FormatterFunc$Closeable$3.apply(FormatterFunc.java:140)
at com.diffplug.spotless.FormatterStepEqualityOnStateSerialization.format(FormatterStepEqualityOnStateSerialization.java:49)
at com.diffplug.spotless.LintState.of(LintState.java:177)
at com.diffplug.spotless.LintState.of(LintState.java:134)
at com.diffplug.gradle.spotless.SpotlessTaskImpl.processInputFile(SpotlessTaskImpl.java:134)
at com.diffplug.gradle.spotless.SpotlessTaskImpl.performAction(SpotlessTaskImpl.java:117)
...
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.