You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @Kafow! That is indeed correct and something we wish to clean up. It hasn't been an issue for us so far because most of our use-cases for dissect.target are fairly short-lived programs, so dangling file handles weren't an issue (they'd be cleaned up as the program exits).
If you could create a PR with a start for fixing this, that'd be appreciated!
Kafow
added a commit
to Kafow/dissect.target
that referenced
this issue
Dec 14, 2022
Hey,
When opening a target there is no option to close its resources that have opened on the filesystem.
For example, consider opening A qcow2 target:
In order to open a qcow2 target we will initialize qcow2container
dissect.target/dissect/target/containers/qcow2.py
Lines 10 to 17 in d1fcfe4
As you can see we are opening a file handle to the path specified:
dissect.target/dissect/target/containers/qcow2.py
Line 14 in d1fcfe4
However, consider we wanna free that target, we will try to call something like
But as it seems, the close function is not implemented in most of the containers, for example Qcow2Container:
dissect.target/dissect/target/containers/qcow2.py
Lines 39 to 40 in d1fcfe4
So the only way to close a file handle right now is to do some workaround like this (considering you have different types of disks):
Instead of just doing a way cleaner code like:
I might try and do a PR later fixing this issue.
Thanks,
Ofek
The text was updated successfully, but these errors were encountered: