[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62896: [Configure] Bug with check for PERL when path has spaces (i.e

From: Mike Frysinger
Subject: bug#62896: [Configure] Bug with check for PERL when path has spaces (i.e. Windows)
Date: Sat, 2 Dec 2023 05:41:14 -0500

On 27 May 2023 19:12, Karl Berry wrote:
> I (finally) installed this patch to quit early if the perl path has
> spaces. Thanks.
> As for MKDIR_P and INSTALL, I guess it is somewhere in the
> prerequisite/autoconf stuff. I suppose it would be rare that they would
> be found in a path with spaces while perl was not, so I think it's ok to
> let that go. --best, karl.
> --- a/configure.ac
> +++ b/configure.ac
> @@ -71,6 +71,12 @@ AC_PATH_PROG([PERL], [perl])
>  if test -z "$PERL"; then
>     AC_MSG_ERROR([perl not found])
>  fi
> +if test x"`echo $PERL | grep ' '`" != "x"; then

this is expanding $PERL unquoted and letting the shell normalize the whitespace
by passing the resulting args to echo.  how strict do we need to be with this ?
for example, this will let some pathological values pass that shouldn't.
        $ PERL="   /usr/bin/perl   "
        $ echo $PERL | grep ' '; echo $?
the advantage of the check as-written is that it normalizes all whitespace (e.g.
tabs) into just spaces which we can grep on.  i'm assuming we can't rely on
`[:space:]` and such.  but maybe including that is portable enough ?
        echo "$PERL" | grep '[ \t]'

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

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]