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 <>
Python-bugs-list mailing list

Reply via email to