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

Guoxiong Li gli at openjdk.java.net
Wed Dec 1 18:10:51 UTC 2021


On Wed, 1 Dec 2021 14:04:05 GMT, Magnus Ihse Bursie <ihse 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
>
> jcheck/src/main/java/org/openjdk/skara/jcheck/BinaryCheck.java line 69:
> 
>> 67:                     try {
>> 68:                         fileSize = path != null ? Files.size(path) : 0;
>> 69:                         needCheck = true;
> 
> Does that mean that jcheck will block renaming an existing binary file if it is larger than the currently accepted maximum? I don't think that is the right behavior. Only adding a new file should trigger this.

I intended to check it. But if you think it don't need to check, I could remove it.

-------------

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


More information about the skara-dev mailing list