Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/fakedate: fix finding the right date executable
@ 2021-12-15 17:34 Ignacy Gawędzki
  2021-12-16 20:03 ` Arnout Vandecappelle
  2022-01-05 20:37 ` Yann E. MORIN
  0 siblings, 2 replies; 6+ messages in thread
From: Ignacy Gawędzki @ 2021-12-15 17:34 UTC (permalink / raw)
  To: buildroot

If the PATH initially contains host/bin, then the right date
executable is to be found after the *first* occurrence of fakedate in
normal (forward) PATH order.  Fix the wrapper so that that first
occurrence is found indeed.

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
---
 package/fakedate/fakedate | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/package/fakedate/fakedate b/package/fakedate/fakedate
index 9bef113357..03a4f04079 100755
--- a/package/fakedate/fakedate
+++ b/package/fakedate/fakedate
@@ -21,13 +21,18 @@
 DATE_BIN=false
 # Do not call any 'date' before us in the PATH, or that would create
 # an infinite recursion.
+last_date=false
 for date in $(which -a date |tac); do
     if [ "${date}" -ef "$0" ]; then
-        break
+	DATE_BIN=$last_date
     fi
-    DATE_BIN="${date}"
+    last_date="${date}"
 done
 
+if [ "$DATE_BIN" = false ]; then
+    DATE_BIN=$last_date
+fi
+
 if [ -n "$SOURCE_DATE_EPOCH" ]; then
     FORCE_EPOCH=1
     for i in "$@"; do
-- 
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-06 10:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-15 17:34 [Buildroot] [PATCH] package/fakedate: fix finding the right date executable Ignacy Gawędzki
2021-12-16 20:03 ` Arnout Vandecappelle
2021-12-16 21:08   ` Yann E. MORIN
2021-12-17 22:28     ` Ignacy Gawędzki
2022-01-05 20:37 ` Yann E. MORIN
2022-01-06 10:32   ` Ignacy Gawędzki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox