GNU bug report logs - #62896
[Configure] Bug with check for PERL when path has spaces (i.e. Windows)

Previous Next

Package: automake;

Reported by: Dan Rosser <danoli3 <at> gmail.com>

Date: Mon, 17 Apr 2023 06:54:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mike Frysinger <vapier <at> gentoo.org>
To: 62896 <at> debbugs.gnu.org, karl <at> freefriends.org
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
[Message part 1 (text/plain, inline)]
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 $?
	1
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
-mike
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 1 year and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.