public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* PATCH: export XATTR_{NAME,SIZE,LIST}_MAX
@ 2023-05-30 11:25 Philippe Cerfon
  2023-05-30 11:35 ` Philippe Cerfon
  2023-05-30 20:04 ` [PATCH] include/cygwin/limits.h: add XATTR_{NAME,SIZE,LIST}_MAX Brian Inglis
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Cerfon @ 2023-05-30 11:25 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

Hey there.

Linux exports XATTR_{NAME,SIZE,LIST}_MAX in it's linux/limits.h and
e.g. the CPython interpreter uses them for it's XATTRs functions.

I made a corresponding PR at CPython
https://github.com/python/cpython/pull/105075 to get the code built
for Cygwin, but right now this would fail due to the missing
XATTR_*_MAX symbols.

The attached patch below would add them to cygwin/limits.h.

But beware, I'm absolutely no Windows/Cygwin expert ^^ - so whether
the values I've chosen are actually correct, is more guesswork rather
than definite knowledge.

As written in the commit message, I think:
- XATTR_NAME_MAX corresponds to MAX_EA_NAME_LEN
and
- XATTR_SIZE_MAX to MAX_EA_VALUE_LEN

though I have no idea, whether these are just lower boundaries used by
Cygwin, while e.g. Windows itself might set longer names or value
lenghts, and thus - when Cygwin would try to read such - it might get
into troubles (or rather e.g. CPython, as it's buffers wouldn't
suffice to read the EA respectively XATTR.

Neither to i have an idea about XATTR_LIST_MAX. I'm not even 100% sure
what it means (I guess the max number of XATTRs per file). Not to
speak about whether there's such maximum for Windows EAs,
And again - as above - what would happen if Windows itself would set
more than that limit and within Cygwin one would try to read/list all.

Thanks,
Philippe

[-- Attachment #2: 0001-export-XATTR_-NAME-SIZE-LIST-_MAX.patch --]
[-- Type: text/x-patch, Size: 1250 bytes --]

From 824bcdf053bfb86570c7edda3c018626dc857a8b Mon Sep 17 00:00:00 2001
From: Philippe Cerfon <philcerf@gmail.com>
Date: Tue, 30 May 2023 13:16:18 +0200
Subject: [PATCH] export XATTR_{NAME,SIZE,LIST}_MAX

These are used for example by CPython. XATTR_NAME_MAX should correspond to
MAX_EA_NAME_LEN and XATTR_SIZE_MAX to MAX_EA_VALUE_LEN.

It's unclear whether Windows imposes a maximum number of EA's per file and which
value should be used for XATTR_LIST_MAX, so for now Linux' value.

Signed-off-by: Philippe Cerfon <philcerf@gmail.com>
---
 winsup/cygwin/include/cygwin/limits.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/winsup/cygwin/include/cygwin/limits.h b/winsup/cygwin/include/cygwin/limits.h
index aefc7c7bd..939ab4f38 100644
--- a/winsup/cygwin/include/cygwin/limits.h
+++ b/winsup/cygwin/include/cygwin/limits.h
@@ -56,4 +56,11 @@ details. */
 #define __PATH_MAX 4096
 #define __PIPE_BUF 4096
 
+/* Keep in sync with MAX_EA_NAME_LEN respectively MAX_EA_VALUE_LEN in
+ * winsup/cygwin/ntea.cc but don not use values that exceed their Linux
+ * counterparts as defined in linux/limits.h. */
+#define XATTR_NAME_MAX 255
+#define XATTR_SIZE_MAX 65536
+#define XATTR_LIST_MAX 65536
+
 #endif /* _CYGWIN_LIMITS_H__ */
-- 
2.40.1


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

* Re: PATCH: export XATTR_{NAME,SIZE,LIST}_MAX
  2023-05-30 11:25 PATCH: export XATTR_{NAME,SIZE,LIST}_MAX Philippe Cerfon
@ 2023-05-30 11:35 ` Philippe Cerfon
  2023-05-30 20:04 ` [PATCH] include/cygwin/limits.h: add XATTR_{NAME,SIZE,LIST}_MAX Brian Inglis
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Cerfon @ 2023-05-30 11:35 UTC (permalink / raw)
  To: newlib

For the records:
There's a corresponding thread of mine over at Cygwin mainling list:
https://cygwin.com/pipermail/cygwin/2023-May/253750.html

Regards.

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

* [PATCH] include/cygwin/limits.h: add XATTR_{NAME,SIZE,LIST}_MAX
  2023-05-30 11:25 PATCH: export XATTR_{NAME,SIZE,LIST}_MAX Philippe Cerfon
  2023-05-30 11:35 ` Philippe Cerfon
@ 2023-05-30 20:04 ` Brian Inglis
  2023-05-30 21:59   ` Philippe Cerfon
  1 sibling, 1 reply; 4+ messages in thread
From: Brian Inglis @ 2023-05-30 20:04 UTC (permalink / raw)
  To: Cygwin Patches; +Cc: newlib, Philippe Cerfon

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

On Tue, 30 May 2023 13:25:38 +0200, Philippe Cerfon wrote:
> Hey there.
> 
> Linux exports XATTR_{NAME,SIZE,LIST}_MAX in it's linux/limits.h and
> e.g. the CPython interpreter uses them for it's XATTRs functions.
> 
> I made a corresponding PR at CPython
> https://github.com/python/cpython/pull/105075 to get the code built
> for Cygwin, but right now this would fail due to the missing
> XATTR_*_MAX symbols.
> 
> The attached patch below would add them to cygwin/limits.h.

Patches for Cygwin under winsup are submitted to cygwin-patches@cygwin.com 
(forwarded there).

> But beware, I'm absolutely no Windows/Cygwin expert ^^ - so whether
> the values I've chosen are actually correct, is more guesswork rather
> than definite knowledge.
> 
> As written in the commit message, I think:
> - XATTR_NAME_MAX corresponds to MAX_EA_NAME_LEN
> and
> - XATTR_SIZE_MAX to MAX_EA_VALUE_LEN
> 
> though I have no idea, whether these are just lower boundaries used by
> Cygwin, while e.g. Windows itself might set longer names or value
> lenghts, and thus - when Cygwin would try to read such - it might get
> into troubles (or rather e.g. CPython, as it's buffers wouldn't
> suffice to read the EA respectively XATTR.
> 
> Neither to i have an idea about XATTR_LIST_MAX. I'm not even 100% sure
> what it means (I guess the max number of XATTRs per file). Not to
> speak about whether there's such maximum for Windows EAs,
> And again - as above - what would happen if Windows itself would set
> more than that limit and within Cygwin one would try to read/list all.
> 
> Thanks,
> Philippe

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

[-- Attachment #2: 0001-export-XATTR_-NAME-SIZE-LIST-_MAX.patch --]
[-- Type: text/x-patch, Size: 1250 bytes --]

From 824bcdf053bfb86570c7edda3c018626dc857a8b Mon Sep 17 00:00:00 2001
From: Philippe Cerfon <philcerf@gmail.com>
Date: Tue, 30 May 2023 13:16:18 +0200
Subject: [PATCH] export XATTR_{NAME,SIZE,LIST}_MAX

These are used for example by CPython. XATTR_NAME_MAX should correspond to
MAX_EA_NAME_LEN and XATTR_SIZE_MAX to MAX_EA_VALUE_LEN.

It's unclear whether Windows imposes a maximum number of EA's per file and which
value should be used for XATTR_LIST_MAX, so for now Linux' value.

Signed-off-by: Philippe Cerfon <philcerf@gmail.com>
---
 winsup/cygwin/include/cygwin/limits.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/winsup/cygwin/include/cygwin/limits.h b/winsup/cygwin/include/cygwin/limits.h
index aefc7c7bd..939ab4f38 100644
--- a/winsup/cygwin/include/cygwin/limits.h
+++ b/winsup/cygwin/include/cygwin/limits.h
@@ -56,4 +56,11 @@ details. */
 #define __PATH_MAX 4096
 #define __PIPE_BUF 4096
 
+/* Keep in sync with MAX_EA_NAME_LEN respectively MAX_EA_VALUE_LEN in
+ * winsup/cygwin/ntea.cc but don not use values that exceed their Linux
+ * counterparts as defined in linux/limits.h. */
+#define XATTR_NAME_MAX 255
+#define XATTR_SIZE_MAX 65536
+#define XATTR_LIST_MAX 65536
+
 #endif /* _CYGWIN_LIMITS_H__ */
-- 
2.40.1


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

* Re: [PATCH] include/cygwin/limits.h: add XATTR_{NAME,SIZE,LIST}_MAX
  2023-05-30 20:04 ` [PATCH] include/cygwin/limits.h: add XATTR_{NAME,SIZE,LIST}_MAX Brian Inglis
@ 2023-05-30 21:59   ` Philippe Cerfon
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Cerfon @ 2023-05-30 21:59 UTC (permalink / raw)
  To: newlib

Hey

On Tue, May 30, 2023 at 10:04 PM Brian Inglis <Brian.Inglis@shaw.ca> wrote:
> Patches for Cygwin under winsup are submitted to cygwin-patches@cygwin.com
> (forwarded there).

Ah, I see. Thanks for forwarding.

Regards,
Philippe

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

end of thread, other threads:[~2023-05-30 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 11:25 PATCH: export XATTR_{NAME,SIZE,LIST}_MAX Philippe Cerfon
2023-05-30 11:35 ` Philippe Cerfon
2023-05-30 20:04 ` [PATCH] include/cygwin/limits.h: add XATTR_{NAME,SIZE,LIST}_MAX Brian Inglis
2023-05-30 21:59   ` Philippe Cerfon

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