echo "$PERL" | grep '[ \t]'

I don't think there's any portable way to use \t to insert a tab in a
shell string, besides literally. There's something like
tab=`printf '\t'`
.. "$tab" ...
but I don't see a need to go that far here. I just used a literal tab char.

    also, can we really not trust the exit status of grep ?
            if echo "$PERL" | grep -q '[\t ]'; then

Exit status yes, but at least historically, grep -q has been considered
non-portable, in favor of grep ... >/dev/null.

I committed the change as below. --thanks, karl.

--

configure: better check for the perl patch containing whitespace.

More for https://bugs.gnu.org/62896.

* configure.ac: quote "$PERL" and check directly with grep.
diff --git a/configure.ac b/configure.ac
index 23a9f97f5..946fecb67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,8 +70,8 @@ AC_PROG_LN_S
 AC_PATH_PROG([PERL], [perl])
 if test -z "$PERL"; then
    AC_MSG_ERROR([perl not found])
-elif test x"`echo $PERL | grep ' '`" != "x"; then
-  AC_MSG_ERROR([The path to your Perl contains spaces.
+elif echo "$PERL" | grep '[    ]' >/dev/null; then
+  AC_MSG_ERROR([The path to your Perl contains spaces or tabs.
 This would cause build failures later or unusable programs.
 Please use a path without spaces and try again.])
 fi

compile finished at Sat Dec  2 14:52:38 2023



Reply via email to