mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Verify native library integrity during extraction/load (#2368)
## Description We've hit a problem where the `CombinedRuntimeLoader` extracts native files, but gets interrupted in the middle. This is bad, cause all `CombinedRuntimeLoader` used to check a file was its existence. This change uses the hash of the file to verify that it's correct. This will be checked at runtime, everytime, if the file is extant. If this check fails, we will delete the extant file and attempt to reextract. We also check a newly extracted file, if that hash does not match we error. Note that this is reliant on https://github.com/PhotonVision/wpilib-tool-plugin/pull/8 and should follow #2367 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_, including events that led to this PR - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with all settings going back to the previous seasons's last release (seasons end after champs ends) - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --------- Co-authored-by: Matt M <matthew.morley.ca@gmail.com>
This commit is contained in:
27
.github/workflows/build.yml
vendored
27
.github/workflows/build.yml
vendored
@@ -443,9 +443,32 @@ jobs:
|
||||
- uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: ${{ matrix.artifact-name }}
|
||||
- run: java -jar ${{ matrix.extraOpts }} *.jar --smoketest
|
||||
# The jar is run twice to exercise different code paths.
|
||||
- run: |
|
||||
echo "=== First run ==="
|
||||
java -jar ${{ matrix.extraOpts }} *.jar --smoketest
|
||||
echo "=== Checking for files to corrupt ==="
|
||||
find ~ -type f \( -name "*.so" -o -name "*.dylib" \) | head -20
|
||||
if [ -d ~/.wpilib ]; then
|
||||
echo "~/.wpilib directory exists"
|
||||
echo "Contents of ~/.wpilib:"
|
||||
find ~/.wpilib -type f \( -name "*.so" -o -name "*.dylib" \) | head -10
|
||||
RANDOM_FILE=$(find ~/.wpilib -type f \( -name "*.so" -o -name "*.dylib" \) | sort -R | head -n 1)
|
||||
if [ ! -z "$RANDOM_FILE" ]; then
|
||||
echo "Corrupting file: $RANDOM_FILE"
|
||||
echo "corrupted data" > "$RANDOM_FILE"
|
||||
else
|
||||
echo "No .so or .dylib files found in ~/.wpilib"
|
||||
fi
|
||||
else
|
||||
echo "~/.wpilib directory does not exist"
|
||||
fi
|
||||
echo "=== Second run ==="
|
||||
java -jar ${{ matrix.extraOpts }} *.jar --smoketest
|
||||
if: ${{ (matrix.os) != 'windows-latest' }}
|
||||
- run: ls *.jar | %{ Write-Host "Running $($_.Name)"; Start-Process "java" -ArgumentList "-jar `"$($_.FullName)`" --smoketest" -NoNewWindow -Wait; break }
|
||||
- run: |
|
||||
ls *.jar | %{ Write-Host "Running $($_.Name)"; Start-Process "java" -ArgumentList "-jar `"$($_.FullName)`" --smoketest" -NoNewWindow -Wait; break }
|
||||
ls *.jar | %{ Write-Host "Running $($_.Name)"; Start-Process "java" -ArgumentList "-jar `"$($_.FullName)`" --smoketest" -NoNewWindow -Wait; break }
|
||||
if: ${{ (matrix.os) == 'windows-latest' }}
|
||||
|
||||
build-image:
|
||||
|
||||
Reference in New Issue
Block a user