commit: b90fdda915a32d501df61aa92710e32ca0bd79ed
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Feb 7 05:06:51 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Feb 7 23:39:33 2023 +0000
URL:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=b90fdda9
Don't shift in is_older_than() unless at least one parameter was given
Now that the test suite runs under sh(1), it has revealed a bug of my
own design. While bash will tolerate the invocation of shift in the
case that the positional parameter list is empty, sh(1) will not. Fix
it by checking whether there is anything to be shifted.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Fixes: b6c180b9851ba94f68016836cbce2dde46e07165
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 ca43e06..3f2dbcd 100644
--- a/functions.sh
+++ b/functions.sh
@@ -377,7 +377,7 @@ is_older_than()
else
ref=
fi
- shift
+ [ "$#" -gt 0 ] && shift
# Consult the hash table in the present shell, prior to forking.
hash gfind 2>/dev/null; has_gfind=$(( $? == 0 ))