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

Replace use of mktemp #56

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Conversation

EliahKagan
Copy link
Contributor

@EliahKagan EliahKagan commented Dec 13, 2023

Fixes #41

This uses NamedTemporaryFile with delete=False to replace the one use of the deprecated mktemp function in smmap (reported in #41).

This avoids the race condition inherent to mktemp, as the file is named and created together in a way that is effectively atomic.

Because NamedTemporaryFile is not being used to automatically delete the file, it use and cleanup are unaffected by the change.

(This PR is conceptually related to gitpython-developers/GitPython#1770.)

This uses NamedTemporaryFile with delete=False to replace the one
use of the deprecated mktemp function in smmap (reported in gitpython-developers#41).

This avoids the race condition inherent to mktemp, as the file is
named and created together in a way that is effectively atomic.

Because NamedTemporaryFile is not being used to automatically
delete the file, it use and cleanup are unaffected by the change.
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@Byron Byron merged commit 04dd210 into gitpython-developers:master Dec 13, 2023
6 checks passed
@EliahKagan EliahKagan deleted the no-mktemp branch December 13, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Don't use mktemp
2 participants