Add jprove wrapper, fix interpreter bugs, improve Archive::Zip#373
Merged
Conversation
c7e68d2 to
83a6f72
Compare
The POST_AUTOINCREMENT and POST_AUTODECREMENT opcodes take two registers (destination and source), but the disassembler was only reading one. This caused the disassembly output to be misaligned and confusing. The actual interpreter execution was correct - only the disassembly output was wrong. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1. Fix run_exiftool_tests.pl to properly detect incomplete tests: - Add 'incomplete' status for tests that ran fewer than planned - Check for incomplete tests BEFORE marking as pass - Add missing test count to summary - Calculate pass rate against planned tests 2. Fix interpreter array operations (push/pop/shift/unshift): - Add getArrayFromRegister() helper to handle RuntimeList conversion - Prevents ClassCastException when register contains RuntimeList - Follows same pattern as executeDerefArray() for consistency These fixes improve ExifTool test accuracy from falsely showing 113 passed to correctly showing 91 fully passed and 22 incomplete. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The register array pooling optimization introduced in commit 9d68652 was causing subtle bugs where registers retained stale values from previous executions. This manifested as Not a HASH reference errors in ExifTool Writer.t test (5/61 tests passing -> 61/61 after fix). The issue was that when reusing a cached register array, old values remained even after clearing with Arrays.fill() - the root cause needs further investigation. For now, disable pooling to ensure correctness. ExifTool Writer.t: 5/61 -> 61/61 Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Add readFromFileHandle method to read ZIP files from file handles - Add zipfileComment() to get/set ZIP file comment - Fix contents() to return (content, status) in list context - Add member accessor methods: lastModFileDateTime (MS-DOS format), versionNeededToExtract, bitFlag, fileComment - Add getRawDosTime helper for MS-DOS timestamp extraction - Add unixTimeToDosFmt for Unix to MS-DOS timestamp conversion This improves compatibility with ExifTool's HandleMember() function. Tests 1, 3, 7, 8 pass. Tests 2, 4, 5, 6 have timestamp timezone issues due to Java's ZipEntry converting DOS timestamps to local time. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Java's ZipEntry uses extended Unix timestamps when available, which causes timezone conversion issues. This commit adds methods to parse the ZIP central directory directly to extract raw DOS timestamps: - extractRawDosTimestamps: Parse from file path - extractRawDosTimestampsFromBytes: Parse from byte array These methods are used in read() and readFromFileHandle() to provide the correct raw DOS timestamps that Perl's Archive::Zip returns. This fixes all 8 ExifTool ZIP.t tests. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Arrays in Perl can have null elements after delete operations (e.g., delete $array[i]). The setFromList fast path was not handling these null elements, causing a NullPointerException when copying array values during list assignment. This fixes ExifTool DNG.t and Nikon.t write tests which use arrays that have had elements deleted. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
8accc4b to
7c121df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the
jprovewrapper script for running Perl tests, fixes bugs in the bytecode disassembler and interpreter, and significantly improves the Archive::Zip implementation for ExifTool compatibility.Changes
prove,App::Prove, andIO::Selectmodules to enable running Perl test files with the standard prove interfacePOST_AUTOINCREMENTandPOST_AUTODECREMENTdisassembly to correctly read both registers (destination and source)RuntimeList NPE Fix
Arrays in Perl can have null elements after delete operations (e.g.,
delete $array[i]). ThesetFromListfast path was not handling these null elements, causing aNullPointerExceptionwhen copying array values during list assignment. This was causing ExifTool DNG.t and Nikon.t write tests to fail.Result: DNG.t (3/3) and Nikon.t (9/9) tests now pass.
Archive::Zip Improvements
The Archive::Zip implementation has been significantly enhanced to support ExifTool's test suite:
(content, status)in list contextlastModFileDateTime,versionNeededToExtract,bitFlag,fileCommentThe key fix was that Java's
ZipEntry.getTime()uses extended Unix timestamps when available and applies timezone conversion, which does not match Perl's Archive::Zip behavior of returning the raw DOS timestamp directly from the ZIP file header. We now parse the central directory ourselves to get the correct raw timestamps.Result: All 8 ExifTool ZIP.t tests now pass.
Disassembler Fix Details
The
POST_AUTOINCREMENTandPOST_AUTODECREMENTopcodes take two registers (destination and source), but the disassembler was only reading one. This caused the bytecode output to be misaligned and confusing when using--interpreter --disassemble.The interpreter execution was always correct - only the visualization was wrong.
Test plan
makepasses (all unit tests)Generated with Devin