Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD Volume detection using local loader fails. #42

Open
twiggler opened this issue Nov 12, 2024 · 0 comments
Open

MD Volume detection using local loader fails. #42

twiggler opened this issue Nov 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@twiggler
Copy link

twiggler commented Nov 12, 2024

When running acquire on a local target,

I get:

[2024-11-12 14:56:05,544] [DEBUG] local?: Attempting to use loader: <lazyattr dissect.target.loaders.local.LocalLoader loaded=True>
[2024-11-12 14:56:05,603] [WARNING] Failed to detect <class 'dissect.target.volumes.md.MdVolumeSystem'> logical volume
[2024-11-12 14:56:05,603] [DEBUG] 
Traceback (most recent call last):
File "/opt/acquire-api/lib/python3.9/site-packages/dissect/target/volume.py", line 192, in detect_volume
File "/opt/acquire-api/lib/python3.9/site-packages/dissect/target/volumes/md.py", line 43, in _detect_volume
File "/opt/acquire-api/lib/python3.9/site-packages/dissect/volume/md/md.py", line 153, in find_super_block
TypeError: unsupported operand type(s) for //=: 'NoneType' and 'int'

When determining the size, it is not taken into account that the size property might be None:

size //= SECTOR_SIZE

Since the BufferedStream is constructed without a size in the local loader: https://github.com/fox-it/dissect.target/blob/a899df6a9ede4394ae3c4efc8f7a5026a8427947/dissect/target/loaders/local.py#L172,

the default value of None is passed to AlignedStream I think.

minimal fix on md.py- fix case of size=none and than do the seek

if (size := getattr(fh, "size", None) is None:  size = fh.seek(0, io.SEEK_END)
@twiggler twiggler added the bug Something isn't working label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant