From 7fbc8603dce8c49a173cac6b99ea3fb3f8e92b2a Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Wed, 21 Nov 2018 10:05:40 +0100 Subject: [PATCH] Added support for inode 0 in TSKPathSpec #320 (#321) * Added support for inode 0 in TSKPathSpec #320 --- dfvfs/path/tsk_path_spec.py | 4 +++- tests/path/tsk_path_spec.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dfvfs/path/tsk_path_spec.py b/dfvfs/path/tsk_path_spec.py index 26d009c8..76fb6d3e 100644 --- a/dfvfs/path/tsk_path_spec.py +++ b/dfvfs/path/tsk_path_spec.py @@ -36,7 +36,9 @@ def __init__( Raises: ValueError: when inode and location, or parent are not set. """ - if (not inode and not location) or not parent: + # Note that pytsk/libtsk overloads inode and a value of 0 is valid in + # contrast to an ext file system. + if (inode is None and not location) or not parent: raise ValueError('Missing inode and location, or parent value.') super(TSKPathSpec, self).__init__(parent=parent, **kwargs) diff --git a/tests/path/tsk_path_spec.py b/tests/path/tsk_path_spec.py index 7fd0a85e..57e14464 100644 --- a/tests/path/tsk_path_spec.py +++ b/tests/path/tsk_path_spec.py @@ -27,7 +27,7 @@ def testInitialize(self): self.assertIsNotNone(path_spec) path_spec = tsk_path_spec.TSKPathSpec( - inode=1, parent=self._path_spec) + inode=0, parent=self._path_spec) self.assertIsNotNone(path_spec)