Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: "Ignacy Gawędzki" <ignacy.gawedzki@green-communications.fr>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/fakedate: fix finding the right date executable
Date: Wed, 5 Jan 2022 21:37:27 +0100	[thread overview]
Message-ID: <20220105203727.GH614810@scaer> (raw)
In-Reply-To: <20211215173432.r75invoe3ff6mthg@zenon.in.qult.net>

Ignacy, All,

On 2021-12-15 18:34 +0100, Ignacy Gawędzki spake thusly:
> 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>

After discussing this with Arnout and Thomas, we concluded that Arnout's
proposal, with my ltile amendment, was the proper solution. Except that
the loop had to be broken on first hit, of course, so I added the proper
break.

I also added a test that we actually did find a date executable.

Of course, if we missed something, then feel free to yel back! ;-)

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  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

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2022-01-05 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-01-06 10:32   ` Ignacy Gawędzki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220105203727.GH614810@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=ignacy.gawedzki@green-communications.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox