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

Avoid crashing the event processing thread on non-utf8 filenames #812

Merged
merged 2 commits into from
Jul 1, 2021

Conversation

lovasoa
Copy link

@lovasoa lovasoa commented Jul 1, 2021

Avoid putting the process in a zombie state when encountering non-unicode filenames.

This patch matches the behavior of the python3 branch on python2:
If a file's name is not a valid string in the filesystem's character encoding, then it is processed with a filename string where the invalid characters are encoded as unicode surrogate pairs.

This matches the behavior of os.fsdecode which is used on python 3

Fixes #811

…code filenames

This patch matches the behavior of the python3 branch on python2:
If a file's name is not a valid string in the filesystem's character encoding, then it is processed with a filename string where the invalid characters are encoded as unicode surrogate pairs.

This matches the behavior of os.fsdecode which is used on python 3

https://docs.python.org/3/library/os.html#os.fsdecode
@lovasoa lovasoa changed the base branch from master to python-2.7 July 1, 2021 17:47
@BoboTiG BoboTiG merged commit 17dd0d7 into gorakhargosh:python-2.7 Jul 1, 2021
@BoboTiG
Copy link
Collaborator

BoboTiG commented Jul 1, 2021

Thanks a lot @lovasoa :)

@lovasoa
Copy link
Author

lovasoa commented Jul 1, 2021

Thanks to you!

@BoboTiG BoboTiG linked an issue Jul 5, 2021 that may be closed by this pull request
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.

an attacker can crash the watcher thread with a non-utf8 filename
2 participants