Menu

#549 [PATCH] Build without PATH_MAX using modern realpath()

closed-fixed
None
2024-11-28
2021-10-03
No

PATH_MAX is optional in POSIX, and at least GNU/Hurd does not define it. Luckly there is no need to use it, as it is possible to use the modern behaviour of realpath() since POSIX.1-2007 [1] that allows NULL as output buffer, returning a newly allocated buffer with the resolved path. Some libc's (e.g. glibc) have been supporting this behaviour even before it was formally accepted in POSIX.

Attached there is a simple patch to use the modern realpath(), removing both PATH_MAX and the GCC warning suppressions.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

1 Attachments

Discussion

  • André Simon

    André Simon - 2022-11-23
    • status: open --> open-accepted
    • assigned_to: André Simon
     
  • André Simon

    André Simon - 2023-01-24
    • status: open-accepted --> closed-fixed
     
  • André Simon

    André Simon - 2023-01-24

    This issue was resolved in the latest 3.2 beta release. Thanks for your patch.

     
  • Xiloynaha

    Xiloynaha - 2024-11-24

    Hi André,
    Release 3.6.4 still seems to contain occurrences of MAX_PATH in the getCurrentDirectory() and getFullPathName() functions. Was this somehow reverted in the meantime?

     
    • André Simon

      André Simon - 2024-11-26

      Hi,

      need to check if it was an accident or if there was a problem.

       
  • André Simon

    André Simon - 2024-11-26
    • status: closed-fixed --> open-accepted
     
  • André Simon

    André Simon - 2024-11-28

    The patch only applied to the Linux variant of getCurrentDirectory, the Windows version still has MAX_PATH. But I intend to replace those by new C++ standard functions anyway.

     
  • André Simon

    André Simon - 2024-11-28
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB