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 is. If
a library has DIR* or "struct dirent" in their public API & ABI,
things break if such a pointer is passed between two components
that were built with different dirent code, because each library
or executable contains its own statically-linked copy.

Reordering the members in the new DIR might make it fully compatible
with the old closedir(). It might also be doable to make the old
readdir() return NULL with zero errno. So if new opendir() was used,
then old readdir() would falsely show the dir as empty and then
closedir() would close it properly. Is that better or worse than
a crash or other weird behavior? Compatibility the other way
around I didn't think at all yet. None of this is attemped in
this patchset.

Changing NAME_MAX may cause bad breakage for similar reasons.

I didn't test rewinddir(), telldir(), or seekdir(). The changes to
those are very simple though so new bugs should be unlikely.

The _WDIR API I only tested that it compiles.

If the patches 1-4 look OK, it's OK to me if they are merged.
There rest should be discussed at least a little. For example,
a mode might be needed that allows best-fit, so reserving
a flag variable for it in the DIR structure could be good.

Lasse Collin (10):
  crt: dirent: Clean up white space
  crt: dirent: Use NULL instead of casting 0 to a pointer
  crt: dirent: Fix errno usage
  crt: dirent: Check the return value of _tfullpath
  crt: dirent: Use memset to initialize the dirent/_wdirent struct
  crt: dirent: Avoid best-fit mapping in the multibyte version (ABI
    break)
  crt: Increase NAME_MAX from 255 to 765 (ABI break)
  crt: dirent: Make long path aware (no MAX_PATH limit)
  crt: dirent: Move DIR and _WDIR definitions to dirent.c
  crt: dirent: Don't #include <io.h> in <dirent.h>

 mingw-w64-crt/misc/dirent.c    | 278 ++++++++++++++++++++++++++-------
 mingw-w64-headers/crt/dirent.h |  63 +-------
 mingw-w64-headers/crt/limits.h |   2 +-
 3 files changed, 224 insertions(+), 119 deletions(-)

-- 
2.47.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to