RFR: 1236: Add jcheck option to check for large binary files

Erik Joelsson erikj at openjdk.java.net
Tue Nov 30 22:59:33 UTC 2021

On Tue, 30 Nov 2021 11:42:56 GMT, Guoxiong Li <gli at openjdk.org> wrote:

> Hi all,
> This patch adds the large binary file check to the jcheck.
> The corresponding configuration is like the following code. Each key/value in the `[checks "binary"]` is a mapper. The `key` means the file pattern and the `value` means the limited file size. For example, `.*\.bin=200B` means the file which ends with `.bin` should not exceed 200 Bytes.
> [checks]
> error = binary
> [checks "binary"]
> .*.bin=200B
> .*.o=1k
> The limited file size can use one of these several units:  b(Byte), kb(KiloByte), mb(MegaByte), gb(GigaByte). The units is case insensitive, which means the `Kb`, `kB` and `KB` are equals to `kb(KiloByte)`. If the unit is not provided, it defauts to `b(Byte)`. And these is no a unit called `bit`.
> The corresponding test cases are added.
> Best Regards,
> -- Guoxiong

First, thank you for taking on this issue!

I agree with Kevin, I don't think we have any need for configuring different file types having different size requirements. I think that it's neat to support it, but we just wouldn't use it for any OpenJDK repo that I know of. If we remove that requirement, then there is no need to list file patterns at all, since the check only applies to binary files anyway, and Git tells us which files are binary already.

It looks like you have taken the existing "binary" check and changed it to be a size check. The existing check wasn't used in the JDK repos, but I suspect someone is using it to forbid any binary files. That functionality seems to be lost with this patch. We can't change existing behavior as that would cause incompatibility with existing .jcheck/conf files.

I propose the following extension to the existing "binary" check:

error = binary

[checks "binary"]

The max-size parameter is optional. If not set, then the binary check works like today, triggering on any binary file, with a reasonable error message that isn't mentioning the size limit, or being too large.


PR: https://git.openjdk.java.net/skara/pull/1247

More information about the skara-dev mailing list