findutils/find-avoid-strftime-s-non-portable-F-specifier.patch
2019-09-30 10:38:48 -04:00

34 lines
1.2 KiB
Diff

From 95816b29d46fb6b64754d4a66e7d918b3f134a1f Mon Sep 17 00:00:00 2001
From: James Youngman <jay@gnu.org>
Date: Sun, 23 Jul 2017 22:19:42 +0100
Subject: [PATCH 110/224] find: avoid strftime's non-portable %F specifier.
* 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 <sms@antinode.info>.
---
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 <sms@antinode.info> */
+ strcpy (fmt, "%Y-%m-%d+%T");
need_ns_suffix = 1;
}
else
--
2.19.1