commit: ff1c7dffd8d121d54f903babd1c8afc41b0e78df
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Oct 14 10:23:16 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 14 12:59:10 2025 +0000
URL:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=ff1c7dff
Don't take EPOCHREALTIME availability as proof of the shell being bash
Presently, there are two working implementations of the _update_time()
function, one of which is intended for bash while the other is intended
for sh. The bash implementation is chosen in the case that the
'EPOCHREALTIME' variable is found to be functional.
However, it is possible for busybox to be built with support for both
the 'EPOCHSECONDS' and 'EPOCHREALTIME' variables. Therefore, it cannot
be assumed that the shell is bash on that basis alone.
Address this issue by also testing whether the 'BASH' variable is
non-empty in the course of selecting the implementation.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/functions.sh b/functions.sh
index 53c35ae..9386912 100644
--- a/functions.sh
+++ b/functions.sh
@@ -951,7 +951,7 @@ _update_pid()
_update_time()
{
# shellcheck disable=3028
- if [ "${EPOCHREALTIME}" != "${EPOCHREALTIME}" ]; then
+ if [ "${BASH}" ] && [ "${EPOCHREALTIME}" != "${EPOCHREALTIME}" ]; then
# shellcheck disable=2034,3045
_update_time()
{