All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - configure.ac: use only portable POSIX shell
Date: Fri, 10 Feb 2023 16:53:18 +0000 (GMT)	[thread overview]
Message-ID: <20230210165318.DEE7A3858C5F@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d456c1f3c509f8a033f3ec5830caaf44e830b644
Commit:        d456c1f3c509f8a033f3ec5830caaf44e830b644
Parent:        631762d6db1390487694e6b7ae1de885911458b2
Author:        David Seifert <soap@gentoo.org>
AuthorDate:    Sun Nov 27 15:35:05 2022 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Fri Feb 10 17:50:27 2023 +0100

configure.ac: use only portable POSIX shell

`[[ ... ]]` only works in bash, and not in POSIX sh, specifically
dash fails on this, which is a popular alternative to bash for running
configure scripts.

test's `-a` and `-o` options are considered obsolescent by POSIX,
because they interact badly with expressions and can become ambiguous
depending on string arguments:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

`==` only works in bash.
---
 configure.ac | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index f39c87d08..f2cf48d8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,7 +206,7 @@ AC_PREFIX_DEFAULT(/usr)
 
 ################################################################################
 dnl -- Clear default exec_prefix - install into /sbin rather than /usr/sbin
-test "$exec_prefix" = NONE -a "$prefix" = NONE && exec_prefix=""
+test "$exec_prefix" = "NONE" && test "$prefix" = "NONE" && exec_prefix=""
 
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
@@ -428,11 +428,11 @@ case "$THIN" in
 		THIN_CHECK_VSN_MAJOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}'`
 		THIN_CHECK_VSN_MINOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}'`
 
-		if test -z "$THIN_CHECK_VSN_MAJOR" -o -z "$THIN_CHECK_VSN_MINOR"; then
+		if test -z "$THIN_CHECK_VSN_MAJOR" || test -z "$THIN_CHECK_VSN_MINOR"; then
 			AC_MSG_WARN([$THIN_CHECK_CMD: Bad version "$THIN_CHECK_VSN" found])
 			THIN_CHECK_VERSION_WARN=y
 			THIN_CHECK_NEEDS_CHECK=no
-		elif test "$THIN_CHECK_VSN_MAJOR" -eq 0 -a "$THIN_CHECK_VSN_MINOR" -lt 3; then
+		elif test "$THIN_CHECK_VSN_MAJOR" -eq 0 && test "$THIN_CHECK_VSN_MINOR" -lt 3; then
 			AC_MSG_WARN([$THIN_CHECK_CMD: Old version "$THIN_CHECK_VSN" found])
 			THIN_CHECK_VERSION_WARN=y
 			THIN_CHECK_NEEDS_CHECK=no
@@ -551,7 +551,7 @@ case "$CACHE" in
 			CACHE_CHECK_NEEDS_CHECK=no
 		elif test "$CACHE_CHECK_VSN_MAJOR" -eq 0 ; then
 			if test "$CACHE_CHECK_VSN_MINOR" -lt 5 \
-				|| test "$CACHE_CHECK_VSN_MINOR" -eq 5 -a "$CACHE_CHECK_VSN_PATCH" -lt 4; then
+				|| ( test "$CACHE_CHECK_VSN_MINOR" -eq 5 && test "$CACHE_CHECK_VSN_PATCH" -lt 4 ); then
 				AC_MSG_WARN([$CACHE_CHECK_CMD: Old version "$CACHE_CHECK_VSN" found])
 				CACHE_CHECK_VERSION_WARN=y
 				CACHE_CHECK_NEEDS_CHECK=no
@@ -803,7 +803,7 @@ fi
 
 ################################################################################
 dnl -- Look for corosync libraries if required.
-if [[ "$BUILD_CMIRRORD" = yes ]]; then
+if test "$BUILD_CMIRRORD" = yes; then
 	pkg_config_init
 
 	if test "$HAVE_CPG" != yes; then
@@ -1403,8 +1403,7 @@ AC_CHECK_LIB(dl, dlopen,
 
 ################################################################################
 dnl -- Check for shared/static conflicts
-if [[ \( "$LVM1" = shared -o "$POOL" = shared \
-      \) -a "$STATIC_LINK" = yes ]]; then
+if ( test "$LVM1" = shared || test "$POOL" = shared ) && test "$STATIC_LINK" = yes; then
 	AC_MSG_ERROR([Features cannot be 'shared' when building statically])
 fi
 
@@ -1506,7 +1505,7 @@ AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getop
 
 ################################################################################
 dnl -- Check for editline
-if test "$EDITLINE" == yes; then
+if test "$EDITLINE" = yes; then
 	PKG_CHECK_MODULES([EDITLINE], [libedit], [
 		AC_DEFINE([EDITLINE_SUPPORT], 1,
 			[Define to 1 to include the LVM editline shell.])], AC_MSG_ERROR(


                 reply	other threads:[~2023-02-10 16:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230210165318.DEE7A3858C5F@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.