Re: [Mingw-w64-public] getmainargs changes

2025-01-16 Thread Pali Rohár
On Thursday 16 January 2025 18:32:08 Lasse Collin wrote: > On 2025-01-14 Pali Rohár wrote: > > Well, warnings are warnings. They are always being added by new > > compiler versions, so I would not be afraid of adding also in new > > mingw-w64 version. And security "warning" for me sounds like a goo

Re: [Mingw-w64-public] [PATCH 06/10] crt: dirent: Avoid best-fit mapping in the multibyte version (ABI break)

2025-01-16 Thread Lasse Collin
On 2025-01-16 Lasse Collin wrote: > +++ b/mingw-w64-headers/crt/dirent.h [...] > + unsigned intdd_errno; dd_errno should be int. I had had a different member there at one point and apparently didn't fix the type. -- Lasse Collin ___ M

[Mingw-w64-public] [PATCH 05/10] crt: dirent: Use memset to initialize the dirent/_wdirent struct

2025-01-16 Thread Lasse Collin
This keeps the code simpler when "struct dirent" is modified. --- mingw-w64-crt/misc/dirent.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mingw-w64-crt/misc/dirent.c b/mingw-w64-crt/misc/dirent.c index 20266966a..8bda0b169 100644 --- a/mingw-w64-crt/misc/dirent.c ++

[Mingw-w64-public] [PATCH 09/10] crt: dirent: Move DIR and _WDIR definitions to dirent.c

2025-01-16 Thread Lasse Collin
Also update two comments in the moved structure to refer to _wfindnext instead of _findnext. DIR and _WDIR are supposed to be opaque structures which applications shouldn't access directly. Also, their arrangement was incorrect from applications' point of view if _USE_32BIT_TIME_T was defined due

[Mingw-w64-public] [PATCH 10/10] crt: dirent: Don't #include in

2025-01-16 Thread Lasse Collin
It was needed for the DIR and _WDIR structures. --- mingw-w64-headers/crt/dirent.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/mingw-w64-headers/crt/dirent.h b/mingw-w64-headers/crt/dirent.h index 95050e61c..e7717ffaa 100644 --- a/mingw-w64-headers/crt/dirent.h +++ b/mingw-w64-headers/crt

[Mingw-w64-public] [PATCH 08/10] crt: dirent: Make long path aware (no MAX_PATH limit)

2025-01-16 Thread Lasse Collin
This makes the dirent functions usable in applications that have been marked as long path aware in their application manifests. --- mingw-w64-crt/misc/dirent.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mingw-w64-crt/misc/dirent.c b/mingw-w64-crt/misc/dirent.c index

[Mingw-w64-public] [PATCH 03/10] crt: dirent: Fix errno usage

2025-01-16 Thread Lasse Collin
The dirent functions are defined in POSIX, and POSIX clearly specifies that no POSIX function shall set errno to zero. If a caller of readdir() wants to distinguish errors from a successful end of the directory, the caller must set errno = 0 before calling readdir(). Don't set errno = ENOENT if th

[Mingw-w64-public] [PATCH 07/10] crt: Increase NAME_MAX from 255 to 765 (ABI break)

2025-01-16 Thread Lasse Collin
NAME_MAX is a POSIX constant; Windows doesn't define it. For this reason, assume that NAME_MAX is only about filenames in multibyte representation. In the UTF-8 code page, filenames can be up to 255 * 3 bytes excluding the terminating null character. (It's not 255 * 4 because four-byte UTF-8 charac

[Mingw-w64-public] [PATCH 01/10] crt: dirent: Clean up white space

2025-01-16 Thread Lasse Collin
--- mingw-w64-crt/misc/dirent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mingw-w64-crt/misc/dirent.c b/mingw-w64-crt/misc/dirent.c index 4897cf492..a5d594cc3 100644 --- a/mingw-w64-crt/misc/dirent.c +++ b/mingw-w64-crt/misc/dirent.c @@ -11,7 +11,7 @@ * Updated by Jer

[Mingw-w64-public] [PATCH 06/10] crt: dirent: Avoid best-fit mapping in the multibyte version (ABI break)

2025-01-16 Thread Lasse Collin
Skip filenames that cannot be converted to the active code page in a lossless manner. If the end of the directory is successfully reached, return NULL with errno = EILSEQ for one time. If readdir() is called again, errno won't be modified again. If a multibyte filename is too long to fit into stru

[Mingw-w64-public] [PATCH 04/10] crt: dirent: Check the return value of _tfullpath

2025-01-16 Thread Lasse Collin
--- mingw-w64-crt/misc/dirent.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mingw-w64-crt/misc/dirent.c b/mingw-w64-crt/misc/dirent.c index 4f9c61b0c..20266966a 100644 --- a/mingw-w64-crt/misc/dirent.c +++ b/mingw-w64-crt/misc/dirent.c @@ -73,7 +73,13 @@ _topendir (c

[Mingw-w64-public] [PATCH 00/10] crt: dirent changes

2025-01-16 Thread Lasse Collin
This series has a few errno handling fixes, error checking fixes, best-fit mapping avoidance, "long path aware" support, and minor cleanups. There has been some discussion about best-fit issues in the "getmainargs changes" thread and on IRC. I wonder how big problem the ABI breakage in patches 6-7

[Mingw-w64-public] [PATCH 02/10] crt: dirent: Use NULL instead of casting 0 to a pointer

2025-01-16 Thread Lasse Collin
--- mingw-w64-crt/misc/dirent.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mingw-w64-crt/misc/dirent.c b/mingw-w64-crt/misc/dirent.c index a5d594cc3..215b0b0b6 100644 --- a/mingw-w64-crt/misc/dirent.c +++ b/mingw-w64-crt/misc/dirent.c @@ -50,13 +50,13 @@ _

Re: [Mingw-w64-public] getmainargs changes

2025-01-16 Thread Lasse Collin
On 2025-01-14 Pali Rohár wrote: > Well, warnings are warnings. They are always being added by new > compiler versions, so I would not be afraid of adding also in new > mingw-w64 version. And security "warning" for me sounds like a good > idea. OK, I agree. :-) Remember that I'm not a MinGW-w64 de