Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/fakedate: Skip other fakedates in PATH
@ 2020-04-20 18:56 Mark Huang
  2020-04-20 21:17 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Huang @ 2020-04-20 18:56 UTC (permalink / raw)
  To: buildroot

If multiple buildroot SDKs are in PATH before /usr/bin (usually accidentally,
but there may be some valid use cases for this), the first two copies of
fakedate will go into a loop calling each other without ever finding
/usr/bin/date. Grep for SOURCE_DATE_EPOCH in the candidate date binary, for
additional verification that it's not another copy of fakedate.

Signed-off-by: Mark Huang <mark.huang@cerebras.net>
---
 package/fakedate/fakedate | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/fakedate/fakedate b/package/fakedate/fakedate
index a64d9b9..7b04568 100755
--- a/package/fakedate/fakedate
+++ b/package/fakedate/fakedate
@@ -23,7 +23,7 @@ DATE_BIN=false
 # Instead, find path of true `date' binary.
 for P in `echo $PATH | tr ':' ' '`; do
     if [ -x "$P/date" ]; then
-        if ! [ "$P/date" -ef "$0" ]; then
+        if ! [ "$P/date" -ef "$0" ] && ! grep -q SOURCE_DATE_EPOCH "$P/date" ; then
             DATE_BIN="$P/date"
             break;
         fi
--
1.8.3.1

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

end of thread, other threads:[~2020-04-20 22:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-20 18:56 [Buildroot] [PATCH 1/1] package/fakedate: Skip other fakedates in PATH Mark Huang
2020-04-20 21:17 ` Yann E. MORIN
2020-04-20 22:04   ` Mark Huang

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