bitflicker64 commented on code in PR #3336:
URL: https://github.com/apache/hugegraph/pull/3336#discussion_r4262659451


##########
hugegraph-server/hugegraph-dist/src/assembly/travis/check-java-runtime-logs.sh:
##########
@@ -0,0 +1,77 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -uo pipefail
+
+# Inspect only logs from a positive run, never a negative-test fixture or a
+# whole workspace. Libraries can print these exceptions and still return 0.
+PATTERN='java\.lang\.reflect\.InaccessibleObjectException:'
+PATTERN+='|java\.lang\.(IllegalAccessError|IllegalAccessException):.*module 
.*does not'
+PATTERN+='|Unrecognized VM option|Unrecognized option:'
+PATTERN+='|Ignoring option .*support was removed|VM option .*is (not 
supported|obsolete|removed)'
+PATTERN+='|Unable to inspect cluster runtime logs:'
+if [[ "${1:-}" == --native ]]; then
+    # Keep native-linkage checks out of suites with intentional missing 
classes.
+    PATTERN+='|undefined 
symbol|UnsatisfiedLinkError|UnsupportedClassVersionError|NoClassDefFoundError'
+    shift
+fi
+if [[ $# -eq 0 ]]; then
+    echo "USAGE: $0 [--native] LOG_FILE_OR_DIRECTORY..." >&2
+    exit 2
+fi
+
+STATUS=0
+check_file() {
+    local file="$1" matches code
+    if [[ ! -f "$file" || ! -r "$file" ]]; then
+        echo "Cannot read runtime log: $file" >&2
+        STATUS=2
+        return
+    fi
+    matches=$(LC_ALL=C grep -EinI -- "$PATTERN" "$file" 2>&1)

Review Comment:
   Minor: `-I` makes grep treat a file that contains a NUL byte as 
non-matching, so such a log passes the gate even when it also holds a 
denied-access line. Reproduced at this head with a two-line log:
   
   ```
   printf 'java.lang.reflect.InaccessibleObjectException: Unable to make field 
accessible: module java.base does not "opens java.lang" to unnamed module 
@1\n2026-10-13 INFO key=\0\0\1 written\n' > server.log
   bash check-java-runtime-logs.sh server.log; echo $?   # prints 0, no output
   ```
   
   `test-check-java-runtime-logs.sh` line 73 pins the same behaviour 
(`binary.log` with the exception class name between NULs must return 0). 
`docs/ci.md` says a required log that cannot be read fails the check, but here 
the file is skipped without a message and without status 2. Directory inputs 
already drop heap dumps and compressed rotations by name, so `-I` is not what 
keeps those out.
   
   Requested change: read text logs with `-a` instead of `-I`, or keep `-I` and 
return status 2 with a `Cannot read runtime log` line when a selected 
`.log`/`.out`/`.err`/`.txt` file is binary, and adjust the `binary.log` fixture 
to match.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to