You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a filename on disk has an invalid name, in the sense that the name is not valid in the character encoding python is using for filenames, pylibacl breaks.
This causes these invalid filenames to be converted to normal unicode strings, using the "surrogate code points" in place of the invalid characters. However, when such a filename is passed to pylibacl (through the ACL constructor file argument), an exception occurs:
actual = posix1e.ACL(file=path)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udce9' in position 99: surrogates not allowed
Looking at the code, I suspect this error comes from the call to PyArg_ParseTupleAndKeywords, which is told to convert into a string using utf-8, which then fails.
Note: This format does not accept bytes-like objects. If you want to accept filesystem paths and convert them to C character strings, it is preferable to use the O& format with PyUnicode_FSConverter() as converter.
The text was updated successfully, but these errors were encountered:
Thanks for the bug report. This is similar (in a sense) to iustin/pyxattr#3 (but that in the Python code). I guess I'll have to have a pass through the code and write some tests with such invalid filenames, before fixing individual functions.
When a filename on disk has an invalid name, in the sense that the name is not valid in the character encoding python is using for filenames, pylibacl breaks.
Since python 3.1, there is a mechanism for supporting filenames like these, using surrogate code points: http://legacy.python.org/dev/peps/pep-0383/
This causes these invalid filenames to be converted to normal unicode strings, using the "surrogate code points" in place of the invalid characters. However, when such a filename is passed to pylibacl (through the ACL constructor file argument), an exception occurs:
Looking at the code, I suspect this error comes from the call to
PyArg_ParseTupleAndKeywords
, which is told to convert into a string using utf-8, which then fails.Looking at the docs for
PyArg_ParseTupleAndKeywords
, it suggests that this problem can be solved by using the0&
format:The text was updated successfully, but these errors were encountered: