From 95816b29d46fb6b64754d4a66e7d918b3f134a1f Mon Sep 17 00:00:00 2001 From: James Youngman Date: Sun, 23 Jul 2017 22:19:42 +0100 Subject: [PATCH] find: avoid strftime's non-portable %F specifier. To: address@hidden * find/print.c (format_date): Avoid passing %F to strftime since some implementation lack it. Pass the synonymous %Y-%m-%d instead. This fixes a bug manifesting on HP Tru64 UNIX V5.1B. Reported by Steven M. Schweda . --- find/print.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/find/print.c b/find/print.c index db6155c9..682197f4 100644 --- a/find/print.c +++ b/find/print.c @@ -631,7 +631,11 @@ format_date (struct timespec ts, int kind) /* Format the main part of the time. */ if (kind == '+') { - strcpy (fmt, "%F+%T"); + /* Avoid %F, some Unix versions lack it. For example: + HP Tru64 UNIX V5.1B (Rev. 2650); Wed Feb 17 22:59:59 CST 2016 + Also, some older HP-UX versions expand %F as the full month (like %B). + Reported by Steven M. Schweda */ + strcpy (fmt, "%Y-%m-%d+%T"); need_ns_suffix = 1; } else -- 2.11.0