In bash 5.3, the newly added examples/loadables/strptime.c uses the
%ld format specifier to printf() time_t values. At least on OpenBSD
time_t is long long, which causes a type mismatch between format
specifier and argument.
The same sort of problem in finfo.c was fixed for 5.3 by passing the
value through an intmax_t variable for printing with %jd. The patch
below uses the same approach.
Index: examples/loadables/strptime.c
--- examples/loadables/strptime.c.orig
+++ examples/loadables/strptime.c
@@ -188,7 +188,8 @@ strptime_builtin (WORD_LIST *list)
{
char *s;
struct tm t, *tm;
- time_t now, secs;
+ time_t now;
+ intmax_t secs;
char *datestr, *format;
int i, opt;
@@ -227,7 +228,7 @@ strptime_builtin (WORD_LIST *list)
if (STREQ (datestr, date_time_modifiers[i].shorthand))
{
secs = now + date_time_modifiers[i].incr;
- printf ("%ld\n", secs);
+ printf ("%jd\n", secs);
return (EXECUTION_SUCCESS);
}
}
@@ -265,7 +266,7 @@ strptime_builtin (WORD_LIST *list)
if (s && *s)
builtin_warning("%s: not completely converted (%s)", datestr, s);
- printf ("%ld\n", secs);
+ printf ("%jd\n", secs);
return (EXECUTION_SUCCESS);
}
--
Christian "naddy" Weisgerber [email protected]