kaiwangleo commented on code in PR #996:
URL: https://github.com/apache/flink-agents/pull/996#discussion_r3793453810
##########
tools/check-license.sh:
##########
@@ -20,41 +20,84 @@
# NOTE: This script is adapted from the Apache Spark project.
-acquire_rat_jar () {
+validate_rat_jar() {
+ local jar_cmd
+
+ if command -v unzip >/dev/null 2>&1; then
+ unzip -tq "$JAR" >/dev/null 2>&1
+ return $?
Review Comment:
Implemented and validated locally. Both validator paths now use an explicit
internal status contract instead of passing through tool-specific exit codes:
```bash
if validator_command; then
return 0
fi
return 1
```
`return 2` is now reserved for the branch where neither `unzip` nor `jar` is
available. As a result, exit status 2 from `unzip` or the `jar` fallback is
treated as an invalid JAR, so a cached corrupt JAR is removed and the
acquisition fails instead of warning and continuing.
I added regression tests for status 2 from both validator paths. Validation
passed:
- `bash -n tools/check-license.sh`
- `bash tools/test/.bats-cache/bats-core/bin/bats
tools/test/unit/check_license.bats` (11 tests passed)
- `git diff --check`
The local commit is `096de159`; it has not been pushed yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]