Go to file
Yann E. MORIN 0fe536b797 package/fakedate: avoid recursion if not first in the PATH
With BR2_REPRODUCIBLE, our 'fakedate' wrapper script will end up in
host/bin/date. Currently, it iterates over all the 'date' found in PATH,
until it finds one that is not the script itself, in an attempt to avoid
infinite recursion by calling itself again and again.

This heuristic works OK in Buildroot, because host/bin/ is first in the
PATH, and so that means the first entry in the PATH is skipped.

However, this is going to fail as soon as our wrapper is not the first
in the PATH. Indeed, in that situation, the current heuristic will stop
on the first 'date' in the PATH, as it is not the script itself, and
since our script was executed, that probably means the first 'date' was
itself a wrapper that ended up calling us. So, calling it again will
eventually trickle to calling us again, and thus creating the loop our
heuristic was made to avoid.

This situation currently does not occur in Buildroot, because host/bin/
is first, *and* we have no package that provide their own 'date' wrapper
during their build steps.

But when we generate an SDK with BR2_REPRODUCIBLE, then our wrapper
script will be in sdk/bin/, and there is no longer any guarantee this
comes first in the PATH, thus opening the possibility that another
buildsystem based on our SDK, but which has its own 'date' wrapper, will
trigger this infinite recursion.

We fix that by iterating, in reverse order, over all the 'date' we can
find in PATH, and when we find ourselves, then we know the one we found
in the iteration just before is the one that we should call.

'which -a' is old enough that we can expect it to be always available;
it has been present at least since Debian Squeeze, released 2011.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-08-28 15:56:52 +02:00
arch arch: add BR2_ARCH_NEEDS_GCC_AT_LEAST_11 2021-06-20 18:46:51 +02:00
board Partial revert "configs/olimex_a20_olinuxino: switch to extlinux.conf" 2021-08-08 23:25:54 +02:00
boot Merge branch 'master' into next 2021-08-26 23:40:57 +02:00
configs Merge branch 'master' into next 2021-08-26 23:40:57 +02:00
docs docs/website: use lore for ml search 2021-08-26 23:09:17 +02:00
fs fs/erofs: add big pcluster support 2021-07-19 22:34:21 +02:00
linux linux: bump CIP RT kernel to version 4.19.198-cip54-rt21 2021-08-19 22:54:40 +02:00
package package/fakedate: avoid recursion if not first in the PATH 2021-08-28 15:56:52 +02:00
support Merge branch 'master' into next 2021-08-26 23:40:57 +02:00
system system: support br2-external init systems 2020-10-14 22:48:42 +02:00
toolchain Revert "toolchain: handle toolchains with multiple ld*.so.* files" 2021-08-26 14:20:23 +02:00
utils utils/test-pkg: remove configurations that are skipped 2021-08-05 22:35:24 +02:00
.defconfig
.flake8 Revert ".flake8: fix check for 80/132 columns" 2021-01-02 17:38:20 +01:00
.gitignore
.gitlab-ci.yml gitlab-ci: update the image version 2020-08-15 09:47:00 +02:00
CHANGES Update for 2021.08-rc2 2021-08-18 12:50:47 +02:00
Config.in Config.in: disable Fortify Source for microblaze 2021-08-23 23:08:05 +02:00
Config.in.legacy package/libmcrypt: drop package 2021-08-20 09:58:18 +02:00
COPYING
DEVELOPERS Merge branch 'master' into next 2021-08-26 23:40:57 +02:00
Makefile Update for 2021.08-rc2 2021-08-18 12:50:47 +02:00
Makefile.legacy Remove BR2_DEPRECATED 2016-10-15 23:14:45 +02:00
README docs: move the IRC channel away from Freenode 2021-05-29 22:16:23 +02:00

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches