Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] infinite loop on windows: searching for files #379

@bkreider

Description

@bkreider

ALL software version info

version 0.10.1

Description of expected behavior and the observed behavior

On windows there are two functions that recursively look in parent directories. Because the windows filesystem is case insensitive, it can get trapped at c:\ forever looping. These two functions suffer from the problem:

  • local_state_file.py:42:def load_for_directory
  • project_lock_file.py:45:def load_for_directory

When it gets to C:\ it does a string compare that looks like this: "c:\ == C:". Since this is never true, it gets trapped in an infinite loop.

       current_dir = directory
        while current_dir != os.path.realpath(os.path.dirname(current_dir)):
            for name in possible_project_lock_file_names:
                path = os.path.join(current_dir, name)
                if os.path.isfile(path):
                    return ProjectLockFile(path)

            if scan_parents:
                current_dir = os.path.dirname(os.path.abspath(current_dir))
                continue
            else:
                break

Metadata

Metadata

Assignees

No one assigned

    Labels

    TRIAGEUncategorized issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions