NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/60219: sysconf overpromises TZNAME_MAX
>Number: 60219
>Category: lib
>Synopsis: sysconf overpromises TZNAME_MAX
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 30 19:35:00 +0000 2026
>Originator: Thomas Klausner
>Release: NetBSD 11.99.5
>Organization:
>Environment:
11.99.5/20260408 and 11.0_RC3
Architecture: x86_64
Machine: amd64
>Description:
When running the gnulib tests for parse-datetime, there is a test failure.
The problem is that the code wants to test extreme cases, so it generates
a time zone string of maximum allowed length and expects that libc will parse
it, but instead it is refused as too long.
Bruno Haible investigated and found that even though sysconf(3) returns
511 for sysconf (_SC_TZNAME_MAX), which is also what I see on my system:
# getconf TZNAME_MAX
511
libc seems to have a limit of 254 instead.
I guess, but haven't verified, that this is from src/lib/libc/time/localtime.c
#ifndef TZNAME_MAXIMUM
# define TZNAME_MAXIMUM 254
#endif
I'm not sure where the 511 for _SC_TZNAME_MAX comes from; however, while
looking for this I found in lib/libc/gen/sysctl.c:
_INT("tzname_max", USER_TZNAME_MAX, NAME_MAX,
"The minimum maximum number of types supported for the "
"name of a timezone"),
where I think 'types' should be replaced by 'characters'.
>How-To-Repeat:
$ git clone --depth=1 https://git.savannah.gnu.org/git/gnulib.git
$ cd gnulib
$ ./gnulib-tool --create-testdir --dir t parse-datetime
$ cd t
$ ./configure && make && make check
>Fix:
Adapt the real limit to the reported limited, or the other way round.
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index