Download raw body.
strftime %_ extensions [was Re: MATE Clock Panel App Glitch]
strftime %_ extensions [was Re: MATE Clock Panel App Glitch]
i think this should be handled in libc
On 20/02/26 12:10 +0000, Stuart Henderson wrote:
> anyone?
>
> On 2025/12/17 15:26, Stuart Henderson wrote:
> > only Crystal's reply (https://marc.info/?l=openbsd-tech&m=176433741111901&w=2)
> > so far; while it would seem better to handle this in strftime, if that's
> > not moving anywhere we should at least patch the port to workaround it
> > for now. ok for the port diff below instead?
> >
> > On 2025/11/28 10:37, Stuart Henderson wrote:
> > > oops, my cc's didn't work (I was holding slrn wrong), resending..
> > >
> > >
> > > On 2025-11-26, Claudio Miranda <quadsix50@gmail.com> 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.
> > > */
> > >
> >
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/x11/mate/panel/Makefile,v
> > diff -u -p -r1.38 Makefile
> > --- Makefile 25 Oct 2025 06:57:28 -0000 1.38
> > +++ Makefile 17 Dec 2025 15:23:26 -0000
> > @@ -3,6 +3,7 @@ COMMENT= panel component for MATE
> > SHARED_LIBS += mate-panel-applet-4 1.1 # 1.1
> >
> > MATE_PROJECT= mate-panel
> > +REVISION= 0
> > MATE_VERSION= 1.28.6
> >
> > SITES= https://github.com/mate-desktop/${MATE_PROJECT}/releases/download/v${MATE_VERSION}/
> > Index: patches/patch-applets_clock_clock-location-tile_c
> > ===================================================================
> > RCS file: patches/patch-applets_clock_clock-location-tile_c
> > diff -N patches/patch-applets_clock_clock-location-tile_c
> > --- /dev/null 1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-applets_clock_clock-location-tile_c 17 Dec 2025 15:23:26 -0000
> > @@ -0,0 +1,36 @@
> > +openbsd libc doesn't support the %_I extension to strftime added in
> > +https://github.com/mate-desktop/mate-panel/commit/9fc7ea0f1495b45eb5dfc773294d3465057f6e63
> > +
> > +stop using as a translated string, to avoid having to patch all the
> > +*.po files
> > +
> > +Index: applets/clock/clock-location-tile.c
> > +--- applets/clock/clock-location-tile.c.orig
> > ++++ applets/clock/clock-location-tile.c
> > +@@ -434,7 +434,7 @@ format_time (struct tm *now,
> > + * weekday differs from the weekday at the location
> > + * (the %A expands to the weekday). The %p expands to
> > + * am/pm. */
> > +- format = _("%_I:%M <small>%p (%A)</small>");
> > ++ format = "%l:%M <small>%p (%A)</small>";
> > + }
> > + else {
> > + /* Translators: This is a strftime format string.
> > +@@ -451,7 +451,7 @@ format_time (struct tm *now,
> > + * It is used to display the time in 12-hours format
> > + * (eg, like in the US: 8:10 am). The %p expands to
> > + * am/pm. */
> > +- format = _("%_I:%M <small>%p</small>");
> > ++ format = "%l:%M <small>%p</small>";
> > + }
> > + else {
> > + /* Translators: This is a strftime format string.
> > +@@ -497,7 +497,7 @@ convert_time_to_str (time_t now, ClockFormat clock_for
> > + * It is used to display the time in 12-hours format (eg, like
> > + * in the US: 8:10 am). The %p expands to am/pm.
> > + */
> > +- format = _("%_I:%M %p");
> > ++ format = "%l:%M %p";
> > + }
> > + else {
> > + /* Translators: This is a strftime format string.
> > Index: patches/patch-applets_clock_clock_c
> > ===================================================================
> > RCS file: patches/patch-applets_clock_clock_c
> > diff -N patches/patch-applets_clock_clock_c
> > --- /dev/null 1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-applets_clock_clock_c 17 Dec 2025 15:23:26 -0000
> > @@ -0,0 +1,18 @@
> > +openbsd libc doesn't support the %_I extension to strftime added in
> > +https://github.com/mate-desktop/mate-panel/commit/9fc7ea0f1495b45eb5dfc773294d3465057f6e63
> > +
> > +stop using as a translated string, to avoid having to patch all the
> > +*.po files
> > +
> > +Index: applets/clock/clock.c
> > +--- applets/clock/clock.c.orig
> > ++++ applets/clock/clock.c
> > +@@ -458,7 +458,7 @@ get_updated_timeformat (ClockData *cd)
> > + /* Translators: This is a strftime format string.
> > + * It is used to display the time in 12-hours format (eg, like
> > + * in the US: 8:10 am). The %p expands to am/pm. */
> > +- time_format = cd->showseconds ? _("%_I:%M:%S %p") : _("%_I:%M %p");
> > ++ time_format = cd->showseconds ? "%l:%M:%S %p" : "%l:%M %p";
> > + else
> > + /* Translators: This is a strftime format string.
> > + * It is used to display the time in 24-hours format (eg, like
--
Regards,
Robert Nagy
strftime %_ extensions [was Re: MATE Clock Panel App Glitch]
strftime %_ extensions [was Re: MATE Clock Panel App Glitch]