Check SQLite3 WAL size before initialization#14
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14 +/- ##
==========================================
+ Coverage 81.91% 82.05% +0.13%
==========================================
Files 31 31
Lines 2334 2346 +12
==========================================
+ Hits 1912 1925 +13
+ Misses 422 421 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Schamper
left a comment
There was a problem hiding this comment.
Looks good but I thought of a small other improvement:
Can you add a close method that closes any file handle we opened ourselves, in case we passed a Path? Don't close it if we received a file-like object.
And add a __enter__ (that just returns self) and __exit__ (that calls close()). Then we can use context managers in dissect.target.
|
I've made some slight changes so we don't need the additional boolean attribute. Let me know what you think. |
|
Thanks! That was the approach I wanted to take, but I couldn't figure out how to do it and opted for the boolean instead. |
When trying to initialize the SQLite3 WAL class an
EOFErroris thrown if the WAL file exists, but is empty. This PR fixes the issue by verifying that the size of the WAL file is non zero.Required for fox-it/dissect.target#1454.