public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* python + XATTRs under cygwin?
@ 2023-05-16 21:06 Philippe Cerfon
  2023-05-30  1:37 ` set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?) Philippe Cerfon
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Cerfon @ 2023-05-16 21:06 UTC (permalink / raw)
  To: cygwin

Hey there.

Is there any known way to use XATTRs (which Cygwin seems to support in
some way, at least the standard attr(1) tool seems to work and somehow
map them into the Windows world) with Python?

The `os` module of Python3 (>3.3) comes with:
os.getxattr()
os.listxattr()
os.removexattr()
os.setxattr()
(see https://docs.python.org/3/library/os.html#linux-extended-attributes)
but these seem to be missing from the Cygwin python packages.

There is even an upstream bug
(https://github.com/python/cpython/issues/90026) about this, which has
however been closed (not because it would be fixed, but because Cygwin
is no officially maintained platform).


There are two external python modules that support xattrs:
python-xattr (https://github.com/xattr/xattr)
python-pyxattr (https://pyxattr.k1024.org/)
but neither seems to be available in Cygwin.


Any ideas or change to get one of these (ideally the ones from os) running?

Thanks,
Philippe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?)
  2023-05-16 21:06 python + XATTRs under cygwin? Philippe Cerfon
@ 2023-05-30  1:37 ` Philippe Cerfon
  2023-05-30 11:28   ` Philippe Cerfon
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Cerfon @ 2023-05-30  1:37 UTC (permalink / raw)
  To: cygwin

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?)
  2023-05-30  1:37 ` set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?) Philippe Cerfon
@ 2023-05-30 11:28   ` Philippe Cerfon
  2023-05-30 11:42     ` marco atzeri
  2023-12-22  4:45     ` set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h Marco Atzeri
  0 siblings, 2 replies; 8+ messages in thread
From: Philippe Cerfon @ 2023-05-30 11:28 UTC (permalink / raw)
  To: cygwin

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?)
  2023-05-30 11:28   ` Philippe Cerfon
@ 2023-05-30 11:42     ` marco atzeri
  2023-05-30 12:04       ` Philippe Cerfon
  2023-12-22  4:45     ` set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h Marco Atzeri
  1 sibling, 1 reply; 8+ messages in thread
From: marco atzeri @ 2023-05-30 11:42 UTC (permalink / raw)
  To: Philippe Cerfon; +Cc: cygwin

On Tue, May 30, 2023 at 1:29 PM Philippe Cerfon via Cygwin wrote:
>
> 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

latest is 3.9.16
https://cygwin.com/packages/summary/python39-src.html

> > 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.

I will look on that, but do not expect anything in short term

Regards
Marco

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?)
  2023-05-30 11:42     ` marco atzeri
@ 2023-05-30 12:04       ` Philippe Cerfon
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Cerfon @ 2023-05-30 12:04 UTC (permalink / raw)
  To: marco atzeri; +Cc: cygwin

Hey Marco.

On Tue, May 30, 2023 at 1:43 PM marco atzeri <marco.atzeri@gmail.com> wrote:
> > > Currently, the most recent version of Python in cygwin is 3.9.9, which
>
> latest is 3.9.16
> https://cygwin.com/packages/summary/python39-src.html

Oops, sorry. For some reason I had 3.9.9 in mind which is however
simply the oldest version on that page.


> I will look on that, but do not expect anything in short term

Thanks :-)

Regards,
Philippe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h
  2023-05-30 11:28   ` Philippe Cerfon
  2023-05-30 11:42     ` marco atzeri
@ 2023-12-22  4:45     ` Marco Atzeri
  2023-12-22 20:33       ` Philippe Cerfon
  1 sibling, 1 reply; 8+ messages in thread
From: Marco Atzeri @ 2023-12-22  4:45 UTC (permalink / raw)
  To: cygwin; +Cc: philcerf

On 30/05/2023 13:28, Philippe Cerfon via Cygwin wrote:
> 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
> 

I am trying to backport on 3.9.18 for Cygwin

Regards
Myrco



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h
  2023-12-22  4:45     ` set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h Marco Atzeri
@ 2023-12-22 20:33       ` Philippe Cerfon
  2023-12-23  3:56         ` Marco Atzeri
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Cerfon @ 2023-12-22 20:33 UTC (permalink / raw)
  To: Marco Atzeri; +Cc: cygwin

Hey Marco.

On Fri, Dec 22, 2023 at 5:46 AM Marco Atzeri <marco.atzeri@gmail.com> wrote:
> I am trying to backport on 3.9.18 for Cygwin

Great to hear!

I think it should be fairly easy. The only thing really needed on the
CPython side is USE_XATTRS being defined.

Regards,
Philippe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h
  2023-12-22 20:33       ` Philippe Cerfon
@ 2023-12-23  3:56         ` Marco Atzeri
  0 siblings, 0 replies; 8+ messages in thread
From: Marco Atzeri @ 2023-12-23  3:56 UTC (permalink / raw)
  To: Philippe Cerfon; +Cc: cygwin

On 22/12/2023 21:33, Philippe Cerfon wrote:
> Hey Marco.
> 
> On Fri, Dec 22, 2023 at 5:46 AM Marco Atzeri <marco.atzeri@gmail.com> wrote:
>> I am trying to backport on 3.9.18 for Cygwin
> 
> Great to hear!
> 
> I think it should be fairly easy. The only thing really needed on the
> CPython side is USE_XATTRS being defined.
> 
> Regards,
> Philippe

please give a try .
I uploaded 3.9.18-1 as test version

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-23  3:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 21:06 python + XATTRs under cygwin? Philippe Cerfon
2023-05-30  1:37 ` set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h (was: python + XATTRs under cygwin?) Philippe Cerfon
2023-05-30 11:28   ` Philippe Cerfon
2023-05-30 11:42     ` marco atzeri
2023-05-30 12:04       ` Philippe Cerfon
2023-12-22  4:45     ` set XATTR_SIZE_MAX and XATTR_LIST_MAX in cygwin/limits.h Marco Atzeri
2023-12-22 20:33       ` Philippe Cerfon
2023-12-23  3:56         ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).