Skip to content

Conversation

@PimSanders
Copy link
Contributor

@PimSanders PimSanders commented Dec 15, 2025

When trying to initialize the SQLite3 WAL class an EOFError is 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.

@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.02%. Comparing base (33bc02a) to head (28a3faa).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
+ Coverage   81.91%   82.02%   +0.10%     
==========================================
  Files          31       31              
  Lines        2334     2348      +14     
==========================================
+ Hits         1912     1926      +14     
  Misses        422      422              
Flag Coverage Δ
unittests 82.02% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@PimSanders PimSanders changed the title Check SQLite3 WAL size Check SQLite3 WAL size before initialization Dec 15, 2025
Copy link
Member

@Schamper Schamper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@PimSanders PimSanders marked this pull request as draft December 29, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants