[issue13669] XATTR_SIZE_MAX and XATTR_LIST_MAX undefined on kfreebsd/debian with eglibc

Pino Toscano report at bugs.python.org
Tue Nov 6 20:55:22 CET 2012


Pino Toscano added the comment:

*_MAX constants are usually defined when the system declares that the maximum limit for that option exist and is already known at compile time.
Python should simply not rely on XATTR_LIST_MAX and XATTR_SIZE_MAX being defined, but just grow the buffers as needed until *getxattr / *listxattr succeed or fail with errno != ERANGE; it seems the case already, although the two *_MAX are used as kind of "upper bound" limit.

Instead of using short lists with sizes to try, what about starting from a size (e.g. 128 for getxattr and 256 for listxattr), and grow the buffer by adding the same value each iteration (or doubling the size)?

----------
nosy: +pino

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13669>
_______________________________________


More information about the Python-bugs-list mailing list