diff --git a/package/fakedate/fakedate b/package/fakedate/fakedate index 9bef113357..7ebbf1f0da 100755 --- a/package/fakedate/fakedate +++ b/package/fakedate/fakedate @@ -18,16 +18,23 @@ # Copyright (C) 2016 Jérôme Pouiller # -DATE_BIN=false # Do not call any 'date' before us in the PATH, or that would create # an infinite recursion. -for date in $(which -a date |tac); do +found=false +for date in $(which -a date); do if [ "${date}" -ef "$0" ]; then + found=true + elif ${found}; then + DATE_BIN="${date}" break fi - DATE_BIN="${date}" done +if [ -z "${DATE_BIN}" ]; then + printf 'fakedate: no real date found in PATH after "%s"\n' "${0}" >&2 + exit 1 +fi + if [ -n "$SOURCE_DATE_EPOCH" ]; then FORCE_EPOCH=1 for i in "$@"; do