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

make_tree_writable: handle junctions and add tests #107

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

lazka
Copy link
Member

@lazka lazka commented Jan 10, 2025

As found out here, os.walk() by default follows junctions, which we don't want and can even lead to loops:
#101 (comment)

Integrate the workaround mentioned in the CPython bug report: python/cpython#67596 (comment) Since this is Python 3.12+ only and we still support 3.10 make it optional though.

This also adds tests, which uncovered some other minor issues: It was not chmoding top-down, which meant that os.walk would skip things if there were no read permissions. So chmod before os.walk() lists the dir.

As found out here, os.walk() by default follows junctions, which we don't
want and can even lead to loops:
msys2#101 (comment)

Integrate the workaround mentioned in the CPython bug report:
python/cpython#67596 (comment)
Since this is Python 3.12+ only and we still support 3.10 make
it optional though.

This also adds tests, which uncovered some other minor issues:
It was not chmoding top-down, which meant that os.walk would
skip things if there were no read permissions. So chmod before
os.walk() lists the dir.
@lazka lazka mentioned this pull request Jan 10, 2025
4 tasks
@jeremyd2019
Copy link
Member

Nice - this won't unbreak the runner until git clean actually removes the junction, but will prevent it from just hanging rather than failing like it should.

@jeremyd2019
Copy link
Member

Since that function came from meson, perhaps they'd be interested in your fixes too?

@lazka
Copy link
Member Author

lazka commented Jan 10, 2025

Since that function came from meson, perhaps they'd be interested in your fixes too?

From what I see it's used there for directories meson creates itself, so unlikely they will have junctions I think.

@lazka lazka merged commit 4f60392 into msys2:main Jan 10, 2025
9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants