There has been a change in the chage.c/print_date function between 4.11.1 and 4.12.3, and the date format is « wrong » because of double % : diff -c shadow-4.11.1/work/shadow-4.11.1/src/chage.c shadow-4.12.3/work/shadow-4.12.3/src/chage.c *** shadow-4.11.1/work/shadow-4.11.1/src/chage.c 2022-01-03 01:46:53.000000000 +0100 --- shadow-4.12.3/work/shadow-4.12.3/src/chage.c 2022-08-09 00:30:40.000000000 +0200 *************** *** 223,242 **** { struct tm *tp; char buf[80]; - char format[80]; - - if (iflg) { - (void) snprintf (format, 80, "%%Y-%%m-%%d"); - } - else { - (void) snprintf (format, 80, "%%b %%d, %%Y"); - } tp = gmtime (&date); if (NULL == tp) { (void) printf ("time_t: %lu\n", (unsigned long)date); } else { ! (void) strftime (buf, sizeof buf, format, tp); (void) puts (buf); } } --- 223,234 ---- { struct tm *tp; char buf[80]; tp = gmtime (&date); if (NULL == tp) { (void) printf ("time_t: %lu\n", (unsigned long)date); } else { ! (void) strftime (buf, sizeof buf, iflg ? "%%Y-%%m-%%d" : "%%b %%d, %%Y", tp); (void) puts (buf); } } Thus, when running chage -l <user>, we do not get the dates displayed but the format : % chage -l <someuser> Last password change : %b %d, %Y Password expires : %b %d, %Y ... Reproducible: Always Steps to Reproduce: 1. run 'chage -l <user>' 2. 3. Actual Results: Print format displayed Expected Results: Dates should be displayep Attaching patch. Beware : the chage program is suid root. I do not think the patch could bring some security risk, but I did not check thoroughly.
Created attachment 802654 [details, diff] Patch to chage.c to correct date format Should be safe (chage is suid root), but no extensive checks done.
Please submit your change upstream; we can backport from there. https://github.com/shadow-maint/shadow
(In reply to Mike Gilbert from comment #2) > Please submit your change upstream; we can backport from there. > > https://github.com/shadow-maint/shadow I should have thought about it. https://github.com/shadow-maint/shadow/issues/564
Thanks! Fixed in 4.13.