Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find_repo function can enter an infinite loop #6524

Open
smithx opened this issue Mar 5, 2023 · 4 comments
Open

find_repo function can enter an infinite loop #6524

smithx opened this issue Mar 5, 2023 · 4 comments

Comments

@smithx
Copy link

smithx commented Mar 5, 2023

Reproduction steps

call

git_buf out{};
git_repository_discover(&out, "\\\\?\\Volume{20693787-e361-42da-97c9-f66d2468f001}\\EFI\\Boot", 0, NULL);

Expected behavior

function return

Actual behavior

function doesn't return
subcall find_repo never break from loop

Version of libgit2 (release number or SHA1)

'main' branch 8164b48

Operating system(s) tested

Windows 10 Pro 22H2

@ethomson
Copy link
Member

ethomson commented Feb 6, 2024

I've struggled here to reproduce this — I don't seem to have this problem on my Windows machine (using my volume GUID). I'll keep trying, but if there's any additional data to reproduce this, that would be helpful.

@smithx
Copy link
Author

smithx commented Feb 7, 2024

You don't need Windows machine to reproduce it. Just check the unit test from PR #6525

test function name is 'test_repo_discover__discovery_starting_at_unmounted_win_root_causes_no_hang'

@ethomson
Copy link
Member

ethomson commented Feb 8, 2024

That test runs successfully on all my machines (macOS, Windows 11) without any changes to the find repo function. Does it still fail for you without any changes?

@smithx
Copy link
Author

smithx commented Feb 10, 2024

You are absolutely right, the test will not fail with some 'uuid-volume' path. We need such a 'uuid-volume' path that will successfully pass here: git_fs_path_prettify(&path, start_path, NULL).
If we go into the loop with path.ptr points to something like this \\\\?\\Volume{11111111-2222-3333-4444-555555555555}\\EFI\\Boot, we will never get out again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants