When `read` encounters EOF before the delimiter, it returns a non-zero
exit status, causing the while loop to terminate immediately. As a result,
if the PATH string doesn't end with a colon, the very last directory in
PATH is ignored by find_binary().
This caused regressions on split-usr architectures where critical
binaries reside exclusively in /bin, and /bin happens to be
appended at the very end of the PATH by dracut.sh.
Appending a virtual colon to the Here-String ensures the loop processes
all directories correctly.
Fixes dracut-ng issue #1467.
printf "%s\n" "${_path}"
return 0
fi
- done <<< "$PATH"
+ done <<< "${PATH}:"
[[ -n ${dracutsysrootdir-} ]] && return 1
type -P "${1##*/}"