anaconda / anaconda-project

Tool for encapsulating, running, and reproducing data science projects
https://anaconda-project.readthedocs.io/en/latest/
Other
216 stars 88 forks source link

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

Open bkreider opened 2 years ago

bkreider commented 2 years ago

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:

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
AlbertDeFusco commented 2 years ago

I believe this PR will fix the issue: https://github.com/Anaconda-Platform/anaconda-project/pull/380