set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?)

Philippe Cerfon philcerf@gmail.com
Tue May 30 11:28:40 GMT 2023


Just for the records:

I've made a PR against CPython that would enable XATTRs with Cygwin:
https://github.com/python/cpython/pull/105075

and sent a patch against newlib, which is AFAICS the right place to
have the XATTR_*_MAX exported:
https://sourceware.org/pipermail/newlib/2023/020347.html

Thanks,
Philippe

On Tue, May 30, 2023 at 3:37 AM Philippe Cerfon <philcerf@gmail.com> wrote:
>
> Hey.
>
> I did some further tests as described in detail at
> https://github.com/python/cpython/issues/90026#issuecomment-1567631574
> and it turns out that Python's code would already support XATTRs on
> Cygwin if the necessary defines were in place.
>
> Currently, the most recent version of Python in cygwin is 3.9.9, which
> uses the following check in cpython/Modules/posixmodule.c:
>    #if defined(HAVE_SYS_XATTR_H) && defined(__GLIBC__) &&
> !defined(__FreeBSD_kernel__) && !defined(__GNU__)
>
> in order to determine whether the XATTR code should be compiled or not.
>
> In CPython’s master this was changed to:
>    #if defined(HAVE_SYS_XATTR_H) && defined(__linux__) &&
> !defined(__FreeBSD_kernel__) && !defined(__GNU__)
>
> I plan on making a PR against CPython, which would also set the
> necessary symbol, if __CYGWIN__ is defined.
>
>
> There are however two problems:
> 1) Compilation then fails, as the code needs the symbols
> XATTR_SIZE_MAX and XATTR_LIST_MAX, which on Linux are defined in
> linux/limits.h as:
>    #define XATTR_SIZE_MAX 65536    /* size of an extended attribute
> value (64k) */
>    #define XATTR_LIST_MAX 65536    /* size of extended attribute
> namelist (64k) */
>
> This would need to be added to cygwin/limits.h with whichever values
> are proper for Cygwin (not sure how to find out?)
>
>
> 2) I guess the changes in CPython won't be backported (and it's not
> even merged)... so Cygwin's Python maintainer will hopefully find the
> time to package newer versions.
> So there will probably quite some time, until it finally works in Python.
>
>
> Anyway, whom can I ask or (1)?
>
>
> Thanks,
> Philippe.


More information about the Cygwin mailing list