GNU bug report logs -
#62896
[Configure] Bug with check for PERL when path has spaces (i.e. Windows)
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62896 in the body.
You can then email your comments to 62896 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Mon, 17 Apr 2023 06:54:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Dan Rosser <danoli3 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-automake <at> gnu.org
.
(Mon, 17 Apr 2023 06:54:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
VER=1.16.4
Building "automake"
checking whether make supports nested variables... no
checking build system type... x86_64-pc-mingw64
checking host system type... x86_64-pc-mingw64
checking for a BSD-compatible install... ./lib/install-sh -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /c/Program Files/Git/usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether ln -s works... no, using cp -pR
checking for perl... /c/Program Files/Git/usr/bin/perl
./configure: line 3475: /c/Program: No such file or directory
configure: error: perl 5.6 or better is required; perl 5.8.2 or better
is recommended. If you have several perl versions
installed, select the one Automake should use using
./configure PERL=/path/to/perl
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Fri, 21 Apr 2023 17:48:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 62896 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello.
Thank you for the bug report. The problem is a bit more complicated,
unfortunately. At least from my point of view.
I did a bit of an analysis. The problem can be replicated on current
master on a Linux - just do
ln -s /usr/bin 'User bins'
export PATH='User bins':$PATH
and reconfigure.
I can surround $PERL and $(PERL) with parentheses (patch attached), but:
1) this doesn't fix the "shebang" lines, like #!/bin/bash, leaving
e.g. bin/aclocal with
#!User bins/perl
and that not only will not work, it still stops the build with
help2man: can't get `--help' info from bin/aclocal
because of
$ bin/aclocal --help
bash: bin/aclocal: User: bad interpreter: No such file or directory
2) this won't work if the correct perl command has options, like when
we need to, for some reason, have e.g. PERL=perl -W
3) I noticed problem 2) because my fake "User bins" appears also in
$(INSTALL) and in $(MKDIR_P) in the generated Makefile. Those cannot
be quoted, because "/whatever/mkdir -p" is not a correct program name.
It's "/whatever/mkdir" and "-p" is a parameter.
Sorry to say this, but until someone provides a better solution, I
recommend installing Perl (and other GNU tools - MinGW, coreutils,
etc.) in paths without spaces, like c:\perl or
c:\users\your_username\perl (assuming "your_username" doesn't have
spaces, of course). This may also save you headaches with all those
scripts which have "#!/bin/bash" or just "bash".
--
Regards - Bogdan ('bogdro') D. (GNU/Linux & FreeDOS)
X86 assembly (DOS, GNU/Linux): http://bogdro.evai.pl/index-en.php
Soft(EN): http://bogdro.evai.pl/soft http://bogdro.evai.pl/soft4asm
www.Xiph.org www.TorProject.org www.LibreOffice.org www.GnuPG.org
[automake-perl-path-spaces-mail.diff (text/x-patch, attachment)]
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Fri, 21 Apr 2023 21:58:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 62896 <at> debbugs.gnu.org (full text, mbox):
Thanks for the report, Dan, and for looking into this, Bogdan.
#!User bins/perl
Apart from anything else, this cannot be solved. Shebang lines do not
support quoting.
Thus I think what we should do is have configure give a better error
message when the Perl path contains whitespace, that is, explicitly
stating it can't be supported. Instead of just failing "by the way" due
to the lack of quoting. Would you be up for making a patch for that?
Thanks,
Karl
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sun, 23 Apr 2023 11:26:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 62896 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Karl Berry <karl <at> freefriends.org>, Fri Apr 21 2023 23:57:12 GMT+0200
(Central European Summer Time)
> Thanks for the report, Dan, and for looking into this, Bogdan.
>
> #!User bins/perl
>
> Apart from anything else, this cannot be solved. Shebang lines do not
> support quoting.
>
> Thus I think what we should do is have configure give a better error
> message when the Perl path contains whitespace, that is, explicitly
> stating it can't be supported. Instead of just failing "by the way" due
> to the lack of quoting. Would you be up for making a patch for that?
Sure, seems easy. Too bad I don't see where configure is checking
for 'mkdir -p' and 'install -c', I could fix that as well.
But anyway, patch for the Perl path attached. I thought about using
'grep -q' and checking the exit code, but maybe this version is more
portable.
--
Regards - Bogdan ('bogdro') D. (GNU/Linux & FreeDOS)
X86 assembly (DOS, GNU/Linux): http://bogdro.evai.pl/index-en.php
Soft(EN): http://bogdro.evai.pl/soft http://bogdro.evai.pl/soft4asm
www.Xiph.org www.TorProject.org www.LibreOffice.org www.GnuPG.org
[automake-perl-path-spaces2-mail.diff (text/x-patch, attachment)]
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sun, 23 Apr 2023 21:26:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 62896 <at> debbugs.gnu.org (full text, mbox):
But anyway, patch for the Perl path attached.
Thanks. Your method seems as good as any to me.
I thought about using
'grep -q' and checking the exit code, but maybe this version is more
portable.
Indeed, grep -q is not portable. It's necessary to >/dev/null instead.
--thanks again, karl.
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sun, 28 May 2023 01:13:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 62896 <at> debbugs.gnu.org (full text, mbox):
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
+ AC_MSG_ERROR([The path to your Perl contains spaces.
+This would cause build failures later or unusable programs.
+Please use a path without spaces and try again.])
+fi
+
# Save details about the selected perl interpreter in config.log.
AM_RUN_LOG([$PERL --version])
$PERL -e 'require 5.006;' || {
Reply sent
to
Karl Berry <karl <at> freefriends.org>
:
You have taken responsibility.
(Sun, 28 May 2023 01:13:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Dan Rosser <danoli3 <at> gmail.com>
:
bug acknowledged by developer.
(Sun, 28 May 2023 01:13:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 25 Jun 2023 11:24:06 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Mike Frysinger <vapier <at> gentoo.org>
to
control <at> debbugs.gnu.org
.
(Sat, 02 Dec 2023 10:30:01 GMT)
Full text and
rfc822 format available.
Did not alter fixed versions and reopened.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 02 Dec 2023 10:30:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sat, 02 Dec 2023 10:42:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 62896 <at> debbugs.gnu.org (full text, mbox):
[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)]
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sat, 02 Dec 2023 22:54:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 62896 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sun, 03 Dec 2023 02:09:02 GMT)
Full text and
rfc822 format available.
Message #40 received at 62896 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 02 Dec 2023 15:53, Karl Berry wrote:
> 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 get that `grep -q` is something historically we've avoided, but i think it's
one of those bad habits we should just get out of. i'll note that gnuconfig
uses `grep -q` in a bunch of places.
not that i'm going to spend time going through the codebase to update all the
usage, so if automake itself currently does it this way, OK.
> I committed the change as below. --thanks, karl.
thanks, lgtm
-mike
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sun, 03 Dec 2023 03:31:01 GMT)
Full text and
rfc822 format available.
Message #43 received at 62896 <at> debbugs.gnu.org (full text, mbox):
On Sat, Dec 2, 2023, at 9:08 PM, Mike Frysinger wrote:
> On 02 Dec 2023 15:53, Karl Berry wrote:
>> Exit status yes, but at least historically, grep -q has been
>> considered non-portable, in favor of grep ... >/dev/null.
>
> i get that `grep -q` is something historically we've avoided, but i
> think it's one of those bad habits we should just get out of.
Hmm, `grep -q` *is* in POSIX, but I seem to recall tripping over a
system that didn't have it (probably either a Solaris successor, or AIX)
during the run-up to Autoconf 2.71. I'm cc:ing Paul Eggert for comment
as I believe he's the person who most recently revised the grep section
of
https://www.gnu.org/software/autoconf/manual/autoconf-2.71/html_node/Limitations-of-Usual-Tools.html
.
zw
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Sun, 03 Dec 2023 05:57:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Dan Rosser <danoli3 <at> gmail.com>
:
bug acknowledged by developer.
(Sun, 03 Dec 2023 05:57:02 GMT)
Full text and
rfc822 format available.
Message #48 received at 62896-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2023-12-02 19:29, Zack Weinberg wrote:
> `grep -q` *is* in POSIX, but I seem to recall tripping over a
> system that didn't have it (probably either a Solaris successor, or AIX)
> during the run-up to Autoconf 2.71.
Solaris 10 /usr/bin/grep does not support -e, -E, -f, -F, -q, or -x.
Solaris 10 is supported by its supplier through January 2025; that's the
usual guideline we use for how long to support a sorta-POSIX OS.
However, the script shouldn't use 'grep'. Instead, it should just use
the shell's builtin pattern matching. That's faster and more portable. I
installed the attached into Automake.
The original bug was fixed before I got to this, so I'm boldly closing
the bug report.
[0001-Simplify-recent-PERL-check.patch (text/x-patch, attachment)]
Information forwarded
to
bug-automake <at> gnu.org
:
bug#62896
; Package
automake
.
(Sun, 03 Dec 2023 12:38:02 GMT)
Full text and
rfc822 format available.
Message #51 received at 62896-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 02 Dec 2023 21:55, Paul Eggert wrote:
> -if test -z "$PERL"; then
> +case $PERL in
AS_CASE ?
-mike
[signature.asc (application/pgp-signature, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 01 Jan 2024 12:24:12 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 130 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.