From 93e931f419cc086e01fc05c444b35aaba03618cc Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 17 Apr 2024 17:22:40 +0200 Subject: [PATCH 1/2] aclocal.m4: Don't use options `-a` and `-o` of `test` They are not portable and also deprecated in the latest POSIX standard. Reported as https://bugs.gentoo.org/913928#c13 --- aclocal.m4 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index aedf739e6fb..e05f587fa15 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -106,8 +106,8 @@ AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [ AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [ r="`eval echo '$'"$1"`" if test -n "$r" \ - -a "$r" != "error" \ - -a "$r" != "no" \ + && test "$r" != "error" \ + && test "$r" != "no" \ && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then true else @@ -149,7 +149,7 @@ AC_DEFUN(STEPMAKE_BISON, [ STEPMAKE_PROGS(BISON, bison, $1) # urg. should test functionality rather than version. - if test "$BISON" = "bison" -a -n "$2"; then + if test "$BISON" = "bison" && test -n "$2"; then STEPMAKE_CHECK_VERSION(BISON, $1, $2) fi ]) @@ -620,7 +620,7 @@ AC_DEFUN(STEPMAKE_PROGS, [ AC_CHECK_PROGS($1, $2, no) STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3) if test $? -eq 0; then - if test -n "$4" -o -n "$5"; then + if test -n "$4" || test -n "$5"; then STEPMAKE_CHECK_VERSION($1, $3, $4, $5) fi fi @@ -720,7 +720,7 @@ AC_DEFUN(STEPMAKE_TEXMF, [ num=`STEPMAKE_NUMERIC_VERSION($ver)` # Avoid buggy metapost versions: 1.600 <= x < 1.803 if test "$num" -ge "1600000" \ - -a "$num" -lt "1803000"; then + && test "$num" -lt "1803000"; then STEPMAKE_ADD_ENTRY($1, ["mpost (due to a bug in metapost, versions 1.600 <= x < 1.803 are not supported; installed: $ver)"]) fi -- GitLab From fd72a9add2e1659ee484aeecf8149d64a8f8b5ba Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 17 Apr 2024 17:22:59 +0200 Subject: [PATCH 2/2] aclocal.m4 (STEPMAKE_NUMERIC_VERSION): Avoid numeric overflow Reported as https://bugs.gentoo.org/913928#c13 --- aclocal.m4 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index e05f587fa15..491a82ca4bf 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -74,10 +74,18 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [ AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [ echo "$1" | awk -F. ' { - if ([$]3) {three = [$]3} - else {three = 0} + one = [$]1 + two = [$]2 + three = [$]3 + + if (one > 1000) { + # for version dates like '20230124', avoiding numeric overflow + three = one + two = 0 + one = 0 + } } - {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}' + {printf "%.0f\n", one*1000000 + two*1000 + three}' ]) -- GitLab