# Buggy code
def _ParsePathSpecification(
    self, knowledge_base, searcher, file_system, path_specification, path_separator
):
    """Parses a file system for a preprocessing attribute.

    Args:
      knowledge_base (KnowledgeBase): to fill with preprocessing information.
      searcher (dfvfs.FileSystemSearcher): file system searcher to preprocess
          the file system.
      file_system (dfvfs.FileSystem): file system to be preprocessed.
      path_specification (dfvfs.PathSpec): path specification that contains
          the artifact value data.
      path_separator (str): path segment separator.

    Raises:
      PreProcessFail: if the preprocessing fails.
    """
    try:
        file_entry = searcher.GetFileEntryByPathSpec(path_specification)
    except IOError as exception:
        relative_path = searcher.GetRelativePath(path_specification)
        if path_separator != file_system.PATH_SEPARATOR:
            relative_path_segments = file_system.SplitPath(relative_path)
            relative_path = "{0:s}{1:s}".format(
                path_separator, path_separator.join(relative_path_segments)
            )

        raise errors.PreProcessFail(
            ("Unable to retrieve file entry: {0:s} with error: {1!s}").format(
                relative_path, exception
            )
        )

    self._ParseFileEntry(knowledge_base, file_entry)


# Traceback (AttributeError)
Processing started.
Traceback (most recent call last):
File "/usr/bin/log2timeline.py", line 83, in <module>
if not Main():
File "/usr/bin/log2timeline.py", line 69, in Main
tool.ExtractEventsFromSources()
File "/usr/lib/python2.7/dist-packages/plaso/cli/log2timeline_tool.py", line 415, in ExtractEventsFromSources
self._PreprocessSources(extraction_engine)
File "/usr/lib/python2.7/dist-packages/plaso/cli/extraction_tool.py", line 188, in _PreprocessSources
resolver_context=self._resolver_context)
File "/usr/lib/python2.7/dist-packages/plaso/engine/engine.py", line 273, in PreprocessSources
self.knowledge_base)
File "/usr/lib/python2.7/dist-packages/plaso/preprocessors/manager.py", line 311, in RunPlugins
artifacts_registry, knowledge_base, searcher, file_system)
File "/usr/lib/python2.7/dist-packages/plaso/preprocessors/manager.py", line 149, in CollectFromFileSystem
knowledge_base, artifact_definition, searcher, file_system)
File "/usr/lib/python2.7/dist-packages/plaso/preprocessors/interface.py", line 82, in Collect
source.separator)
File "/usr/lib/python2.7/dist-packages/plaso/preprocessors/interface.py", line 135, in _ParsePathSpecification
self._ParseFileEntry(knowledge_base, file_entry)
File "/usr/lib/python2.7/dist-packages/plaso/preprocessors/linux.py", line 194, in _ParseFileEntry
if file_entry.link:
AttributeError: 'NoneType' object has no attribute 'link'

# Fixed code
def _ParsePathSpecification(
    self, knowledge_base, searcher, file_system, path_specification, path_separator
):
    """Parses a file system for a preprocessing attribute.

    Args:
      knowledge_base (KnowledgeBase): to fill with preprocessing information.
      searcher (dfvfs.FileSystemSearcher): file system searcher to preprocess
          the file system.
      file_system (dfvfs.FileSystem): file system to be preprocessed.
      path_specification (dfvfs.PathSpec): path specification that contains
          the artifact value data.
      path_separator (str): path segment separator.

    Raises:
      PreProcessFail: if the preprocessing fails.
    """
    try:
        file_entry = searcher.GetFileEntryByPathSpec(path_specification)
    except IOError as exception:
        relative_path = searcher.GetRelativePath(path_specification)
        if path_separator != file_system.PATH_SEPARATOR:
            relative_path_segments = file_system.SplitPath(relative_path)
            relative_path = "{0:s}{1:s}".format(
                path_separator, path_separator.join(relative_path_segments)
            )

        raise errors.PreProcessFail(
            ("Unable to retrieve file entry: {0:s} with error: {1!s}").format(
                relative_path, exception
            )
        )

    if file_entry:
        self._ParseFileEntry(knowledge_base, file_entry)