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.05%. Comparing base (33bc02a) to head (cfe07e6).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
unittests 82.05% <100.00%> (+0.13%) ⬆️

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
@Schamper
Copy link
Member

Schamper commented Jan 5, 2026

I've made some slight changes so we don't need the additional boolean attribute. Let me know what you think.

@PimSanders
Copy link
Contributor Author

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.

@Schamper Schamper marked this pull request as ready for review January 5, 2026 14:23
@Schamper Schamper merged commit cba61a9 into fox-it:main Jan 5, 2026
23 checks passed
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