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

Fix potential infinite loop with no error when using recursive makedirs #35849

Merged
merged 1 commit into from
Aug 29, 2016
Merged

Fix potential infinite loop with no error when using recursive makedirs #35849

merged 1 commit into from
Aug 29, 2016

Conversation

theredcat
Copy link

What does this PR do?

Fix an infinite loop in the file.makedirs function. If you provide a relative path with a trailing / (e.g. : file.makedirs mydir/), it will result in an infinite loop since the first loop will return "mydir" and os.path.dirname("mydir") will return an empty string, which is not a directory that can exists.

I ran into this passing a relative path to archive.extracted state, which add a / to the path if it's not present, but the behavior is the same when calling the module directly

What issues does this PR fix or reference?

Maybe #34478 ?

Previous Behavior

Infinite loop when calling file.makedirs with a relative path which have a trailing path

New Behavior

Throw an error when an infinite loop is detected

Tests written?

No

@theredcat theredcat changed the base branch from develop to 2016.3 August 29, 2016 09:50
@cachedout
Copy link
Contributor

Oooh, nice catch here! Thanks very much @theredcat . Well done!

@cachedout cachedout merged commit dc705ff into saltstack:2016.3 Aug 29, 2016
@theredcat
Copy link
Author

You're welcome :)

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