From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: newlib@sourceware.org
Subject: Re: [PATCH 0/1] newlib/libc/time/tzset_r.c(_tzset_unlocked_r): add POSIX <> quoted abbrs
Date: Tue, 15 Feb 2022 22:38:23 -0700 [thread overview]
Message-ID: <f01fa003-95ec-2bd2-c4e1-7bf0330a0d06@SystematicSw.ab.ca> (raw)
In-Reply-To: <1451bc59-821e-aa0f-100a-8abceca94662@SystematicSw.ab.ca>
On 2022-02-15 15:04, Brian Inglis wrote:
> Submitted a newlib patch which builds okay, but cannot test, as I don't
> have a newlib platform to run on, and Cygwin uses it's own TZ DB code base.
> It should accept up to 10 character abbreviations for STD and DST
> matching POSIX specs including anything within < > quoted content.
> If someone needing this could build, test, and send feedback, I'd
> appreciate it.
> ---
> newlib/libc/time/tzset_r.c | 68 ++++++++++++++++++++++++++++++++------
> 1 file changed, 58 insertions(+), 10 deletions(-)
Regarding the 10 character limit above, reviewing the POSIX and tzset.c
documentation, the size limit should be TZNAME_MAX, so some changes may
need to be made to the values or the code, as _POSIX_TZNAME_MAX is the
minimum acceptable value:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
and the value used should be that configured:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html
also:
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap08.html#tag_21_08_03_05
newlib/libc/include/sys/unistd.h:#define _SC_TZNAME_MAX 20
newlib/libc/sys/rtems/include/limits.h:#define _POSIX_TZNAME_MAX 3
newlib/libc/sys/rtems/include/limits.h:#define TZNAME_MAX 3
winsup/cygwin/include/limits.h:#define _POSIX_TZNAME_MAX 6
Discussion of whether and how to define and align TZNAME_MAX values are
welcome: Cygwin punts and leaves it undefined, so developers have a
choice of using the alternatives unistd.h sysconf(_SC_TZNAME_MAX) or
_POSIX_TZNAME_MAX.
I am inclined to use if defined in order:
* limits.h TZNAME_MAX
* unistd.h sysconf(_SC_TZNAME_MAX) if available
* limits.h _POSIX_TZNAME_MAX
* 6!
Quoting and limits were changed in The Open Group Technical Standard
Base Specifications, Issue 6, April 2004; IEEE POSIX 1003.1-2004.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
next prev parent reply other threads:[~2022-02-16 5:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 21:57 [PATCH] " Brian Inglis
2022-02-15 22:04 ` [PATCH 0/1] " Brian Inglis
2022-02-16 5:38 ` Brian Inglis [this message]
2022-02-16 8:55 ` Corinna Vinschen
2022-02-16 19:18 ` Brian Inglis
2022-02-17 12:11 ` Corinna Vinschen
2022-02-18 3:43 ` Brian Inglis
2022-02-18 14:16 ` Jon Turney
2022-02-19 5:31 ` Brian Inglis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f01fa003-95ec-2bd2-c4e1-7bf0330a0d06@SystematicSw.ab.ca \
--to=brian.inglis@systematicsw.ab.ca \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).