From patchwork Wed Dec 15 17:34:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ignacy_Gaw=C4=99dzki?= X-Patchwork-Id: 1568510 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JDj6v2PSDz9s5P for ; Thu, 16 Dec 2021 04:34:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 34824409FE; Wed, 15 Dec 2021 17:34:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D3QHPUcvW-K5; Wed, 15 Dec 2021 17:34:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 60005409FA; Wed, 15 Dec 2021 17:34:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 11E0A1BF2CF for ; Wed, 15 Dec 2021 17:34:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id F32E4409FA for ; Wed, 15 Dec 2021 17:34:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nydQBzavWkRn for ; Wed, 15 Dec 2021 17:34:40 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by smtp2.osuosl.org (Postfix) with ESMTPS id DB0A1409ED for ; Wed, 15 Dec 2021 17:34:39 +0000 (UTC) Received: from mail.qult.net (unknown [78.193.33.39]) by smtp6-g21.free.fr (Postfix) with ESMTPS id 3102C780375 for ; Wed, 15 Dec 2021 18:34:36 +0100 (CET) Received: from zenon.in.qult.net ([192.168.64.1]) by mail.qult.net with esmtp (Exim 4.90_1) (envelope-from ) id 1mxYAl-0000kH-VV for buildroot@buildroot.org; Wed, 15 Dec 2021 18:34:36 +0100 Received: from ig by zenon.in.qult.net with local (Exim 4.94.2) (envelope-from ) id 1mxYAi-000qLL-Ss for buildroot@buildroot.org; Wed, 15 Dec 2021 18:34:32 +0100 Date: Wed, 15 Dec 2021 18:34:32 +0100 From: Ignacy =?utf-8?b?R2F3xJlkemtp?= To: buildroot@buildroot.org Message-ID: <20211215173432.r75invoe3ff6mthg@zenon.in.qult.net> MIME-Version: 1.0 Content-Disposition: inline Subject: [Buildroot] [PATCH] package/fakedate: fix finding the right date executable X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@buildroot.org Sender: "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 --- 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