On 2025-11-26, Claudio Miranda <[email protected]> wrote:
> --0000000000001fa64a0644755b51
> Content-Type: text/plain; charset="UTF-8"
>
> Greetings and apologies for the delayed reply to the list and to Carson.

moving to tech@ and CC'ing maintainer

> So, I finally had a chance to look at this, and it's actually "_I" (as
> in "India") and not a lowercase L as I originally thought (changing
> the application font in MATE to Serif confirmed this). While not
> directly related to what I found, this bug report for the clock applet
> gave me a hint as to what exactly the typo is, and it looks like it
> should be "%_I" (as in "India"). The percent sign is missing, hence
> the time showing up as "_I:ss PM" (where "ss" is seconds which
> displays correctly on the applet).
>
> https://github.com/mate-desktop/mate-panel/issues/1451
>
> I've only seen this happen on the OpenBSD port of the MATE Clock
> applet. Checked MATE Clock on FreeBSD and Fedora (where I run MATE
> Desktop) and those display correctly.

to fix that issue, mate-panel changed from one strftime extension
(%l, supported by OpenBSD but not musl libc) to another (%_I, glibc
extension, supported by musl libc, FreeBSD and reportedly AIX, Solaris)

the %_ extension is from a set of three modifiers which specify padding
behaviour instead of the default for the following format character:

%0K - like %K but pad numbers with zeros
%_K - like %K but pad numbers with spaces
%-K - like %K but do not pad numbers

patching this in mate-panel is a pain because the strftime strings
are used as translated strings (i.e. changing to the common local
format where available) so a bunch of .po files would need patches.

taking a cue from libc's "support" for %E/%O (C99 locale modifiers
which are recognised but ignored) here's a diff to ignore the modifiers
so at least we'd get something sensible printed in these cases. (if
testing with date(1) note that it's statically linked). would this
or something like it make sense?

Index: time/strftime.c
===================================================================
RCS file: /cvs/src/lib/libc/time/strftime.c,v
diff -u -p -r1.34 strftime.c
--- time/strftime.c     16 May 2025 14:24:39 -0000      1.34
+++ time/strftime.c     26 Nov 2025 10:06:55 -0000
@@ -477,6 +477,16 @@ label:
                                pt = _fmt(Locale->date_fmt, t, pt, ptlim,
                                        warnp);
                                continue;
+                       case '0':
+                       case '-':
+                       case '_':
+                               /*
+                                * GNU libc extensions.
+                                * 0 should explicitly specify zero for padding.
+                                * - should avoid padding numerical outputs.
+                                * _ should xplicitly specify space for padding.
+                                */
+                               goto label;
                        case '%':
                        /*
                        ** X311J/88-090 (4.12.3.5): if conversion char is
Index: time/strptime.c
===================================================================
RCS file: /cvs/src/lib/libc/time/strptime.c,v
diff -u -p -r1.34 strptime.c
--- time/strptime.c     20 Nov 2025 10:59:56 -0000      1.34
+++ time/strptime.c     26 Nov 2025 10:06:55 -0000
@@ -132,6 +132,15 @@ literal:
                break;
 
                /*
+                * "Padding" modifiers. Not handled but set the appropriate
+                * flag and start over again.
+                */
+               case '_':       /* "%_?" pad numbers with spaces. */
+               case '0':       /* "%0?" pad numbers with zeros. */
+               case '-':       /* "%-?" do not pad numbers. */
+                       goto again;
+
+               /*
                 * "Alternative" modifiers. Just set the appropriate flag
                 * and start over again.
                 */

Reply via email to