fox-it/dissect.target

TarLoader issues

JSCU-CNI opened this issue · 3 comments

We've come across two issues regarding the use of tar-files:

  1. With the merge of #112, the class TarFile is removed. This however breaks the AsdfLoader.
  2. In the TarLoader, directories are skipped. It seems that as result of this, empty folders are not included in for example target.walkfs(), although they might be of value from a forensic point of view. The current test does not include the occurrence of empty folders within a tar-file.

I believe both of these issues are currently resolved. Can you confirm and close the issue if this is the case?

The latter issue has indeed been fixed with #144 and #195. The first issue however still seems to be present. The AsdfLoader still tries to import TarFile from dissect.target.loaders.tar in loaders/asdf.py.

This is output from the latest main branch of dissect.target:

$ target-shell example.E01 -vvvvv
2023-04-06T12:01:25.405640Z [warning  ] Failed to import <lazyattr dissect.target.loaders.asdf.AsdfLoader loaded=False> [dissect.target.loader] 
2023-04-06T12:01:25.405721Z [debug    ]            [dissect.target.loader] 
Traceback (most recent call last):
  File "/tmp/dissect.target/dissect/target/loader.py", line 147, in find_loader
    if loader.detect(item):
  File "/tmp/dissect.target/dissect/target/helpers/lazy.py", line 57, in __getattr__
    self._realattr = getattr(self.module._module, self.attr)  # noqa
  File "/tmp/dissect.target/dissect/target/helpers/lazy.py", line 38, in __getattr__
    self._error()
  File "/tmp/dissect.target/dissect/target/helpers/lazy.py", line 32, in _error
    raise ImportError(f"Failed to lazily import {self.module._module_name}: {self.exc}")  # noqa
ImportError: Failed to lazily import dissect.target.loaders.asdf: cannot import name 'TarFile' from 'dissect.target.loaders.tar' (/tmp/dissect.target/dissect/target/loaders/tar.py)

Ah correct, made a quick PR for that!