mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jan Mercl <0xjnml@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] strftime missing some format verbs
Date: Wed, 28 Feb 2024 13:54:10 +0100	[thread overview]
Message-ID: <CAA40n-UpO8k3S9OcqrxpKD-qgXjAGtz4Gqa=q8CHCsMaWc6RPw@mail.gmail.com> (raw)

Hi list,

while testing SQLite 3.45.1 with a transpilled-to-Go version of musl
libc, date4.test (from the SQLite Tcl test suite) reports errors. The
reason is the lack of support for the %l, %k and %P format verbs. The
tests pass with this patch:

    --- ./musl-80e3b09823a1d718664bc13704f3f7c19038a19e/src/time/strftime.c
       2024-02-26 21:23:01.000000000 +0100
    +++ ./internal/overlay/musl/src/time/strftime.c        2024-02-28
13:28:36.239990577 +0100
    @@ -96,6 +96,8 @@
             case 'H':
                     val = tm->tm_hour;
                     goto number;
    +        case 'l':
    +                def_pad = '_';
             case 'I':
                     val = tm->tm_hour;
                     if (!val) val = 12;
    @@ -105,6 +107,10 @@
                     val = tm->tm_yday+1;
                     width = 3;
                     goto number;
    +        case 'k':
    +                val = tm->tm_hour;
    +                def_pad = '_';
    +                goto number;
             case 'm':
                     val = tm->tm_mon+1;
                     goto number;
    @@ -117,6 +123,14 @@
             case 'p':
                     item = tm->tm_hour >= 12 ? PM_STR : AM_STR;
                     goto nl_strcat;
    +        case 'P':
    +                item = tm->tm_hour >= 12 ? PM_STR : AM_STR;
    +                fmt = __nl_langinfo_l(item, loc);
    +                char *d = *s;
    +                for (*l = 0; *fmt; (*l)++) {
    +                        *d++ = tolower(*fmt++);
    +                }
    +                return *s;
             case 'r':
                     item = T_FMT_AMPM;
                     goto nl_strftime;

Those verbs seem to be not part of POSIX, so maybe musl does not
support them intentionally.

Regards,

-j

                 reply	other threads:[~2024-02-28 12:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAA40n-UpO8k3S9OcqrxpKD-qgXjAGtz4Gqa=q8CHCsMaWc6RPw@mail.gmail.com' \
    --to=0xjnml@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).