[PROPOSED] Port recent PATH_MAX change to strict C23
* localtime.c (tzdirslashlen): Now an enum, not a const size_t, as strict C23 requires this for the static_assert that uses tzdirslashlen when PATH_MAX is defined. --- localtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localtime.c b/localtime.c index 3f3bdce5..ec13ed71 100644 --- a/localtime.c +++ b/localtime.c @@ -676,7 +676,7 @@ union input_buffer { ATTRIBUTE_NONSTRING #endif static char const tzdirslash[sizeof TZDIR + OPENAT_TZDIR] = TZDIR "/"; -static size_t const tzdirslashlen = sizeof TZDIR; +enum { tzdirslashlen = sizeof TZDIR }; /* Local storage needed for 'tzloadbody'. */ union local_storage { -- 2.48.1
On 10/12/25 16:56, Paul Eggert via tz wrote:
* localtime.c (tzdirslashlen): Now an enum, not a const size_t, as strict C23 requires this for the static_assert that uses tzdirslashlen when PATH_MAX is defined. ... I haven't been following this; stumbled on. But I know one implementation which makes PATH_MAX configurable; filesystype- dependent. So, call a function to get PATH_MAX. Gasp! (But they shun TZDATA!)
-- gil
On 10/12/25 16:56, Paul Eggert via tz wrote:
* localtime.c (tzdirslashlen): Now an enum, not a const size_t, as strict C23 requires this for the static_assert that uses tzdirslashlen when PATH_MAX is defined. ... I haven't been following this; stumbled on. But I know one implementation which makes PATH_MAX configurable; filesystype- dependent. So, call a function to get PATH_MAX. Gasp! (But they shun TZDATA!)
Oops! namely: <https://www.ibm.com/docs/en/zos/3.2.0?topic=functions-fpathconf-determine-co...> -- gil
On 2025-10-12 18:02, Paul Gilmartin via tz wrote:
<https://www.ibm.com/docs/en/zos/3.2.0?topic=functions-fpathconf-determine-co...>
We should be OK. tzcode uses PATH_MAX only if defined, so if z/OS does not define PATH_MAX it would be like GNU/Hurd (which also does not define PATH_MAX), and on such a platform tzcode allocates a buffer for the absolute file name via malloc if the relative file name is very long. I don't have easy access to a z/OS platform to make sure it works there. If you'd like to jump through the hoops to gain access, say at OSUOSL <https://osuosl.org/services/ibm-z/>, please feel free to see how well tzcode works there.
(But they shun TZDATA!) Yes, although z/OS supports tzdata in its Java runtime:
https://www.ibm.com/docs/en/semeru-runtime-ce-z/21.0.0?topic=configuring-tim... ... I don't see any such support in the z/OS C library.
On 2025-10-12 23:20, Paul Eggert via tz wrote:
On 2025-10-12 18:02, Paul Gilmartin via tz wrote:
<https://www.ibm.com/docs/en/zos/3.2.0?topic=functions-fpathconf-determine- configurable-path-name-variables>
We should be OK. tzcode uses PATH_MAX only if defined, so if z/OS does not define PATH_MAX it would be like GNU/Hurd (which also does not define PATH_MAX), and on such a platform tzcode allocates a buffer for the absolute file name via malloc if the relative file name is very long.
I don't have easy access to a z/OS platform to make sure it works there. If you'd like to jump through the hoops to gain access, say at OSUOSL <https:// osuosl.org/services/ibm-z/>, please feel free to see how well tzcode works there.
(But they shun TZDATA!) Yes, although z/OS supports tzdata in its Java runtime:
https://www.ibm.com/docs/en/semeru-runtime-ce-z/21.0.0?topic=configuring-tim... tz@iana.org
Probably required for CLDR/ICU support.
... I don't see any such support in the z/OS C library.
Some docs appear to be in z/VM and z/OS Language Environment Open Extensions: https://www.vm.ibm.com/openextensions/oelsc.html including locale and formatting functions, and appears to support NLS, charmap, and localedef using POSIX compatible VM/CMS Byte FS layer under Shared FS supporting shared access to hierarchical directories, but other than locale and TZ env var support, little about time zones and nothing about tzdata under native tools, rather than Linux guests. Z/VM seems to be the supported host for interactive native open development, using z/OS tools and ported POSIX library, commands, and utilites, to be run under either z/VM or z/OS. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut -- Antoine de Saint-Exupéry
On 10/13/25 14:38, Brian Inglis via tz wrote:
Some docs appear to be in z/VM and z/OS Language Environment Open Extensions:
https://www.vm.ibm.com/openextensions/oelsc.html
including locale and formatting functions, and appears to support NLS, charmap, and localedef using POSIX compatible VM/CMS Byte FS layer under Shared FS supporting shared access to hierarchical directories, but other than locale and TZ env var support, little about time zones and nothing about tzdata under native tools, rather than Linux guests. Z/VM seems to be the supported host for interactive native open development, using z/OS tools and ported POSIX library, commands, and utilites, to be run under either z/VM or z/OS.
... z/OS 3.2.0 wants to make it hard for you. in: <https://pubs.opengroup.org/onlinepubs/9799919799/functions/realpath.html> The Open Group Base Specifications Issue 8 NAME realpath — resolve a pathname ... If resolved_name is a null pointer, the generated pathname shall be stored as a null-terminated string in a buffer allocated as if by a call to malloc(). ... whereas: <https://www.ibm.com/docs/en/zos/3.2.0?topic=functions-realpath-resolve-path-...> EINVAL Either the file_name or resolved_name argument is a NULL pointer. -- gil
participants (3)
-
brian.inglis@systematicsw.ab.ca -
Paul Eggert -
Paul Gilmartin