GNU bug report logs - #74453
running make failed when perl is installed in the very long path

Previous Next

Package: automake;

Reported by: "Li, Changqing" <Changqing.Li <at> windriver.com>

Date: Thu, 21 Nov 2024 04:25:03 UTC

Severity: normal

Done: Karl Berry <karl <at> freefriends.org>

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 74453 in the body.
You can then email your comments to 74453 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Thu, 21 Nov 2024 04:25:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Li, Changqing" <Changqing.Li <at> windriver.com>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Thu, 21 Nov 2024 04:25:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Li, Changqing" <Changqing.Li <at> windriver.com>
To: "bug-automake <at> gnu.org" <bug-automake <at> gnu.org>
Cc: "Li, Changqing" <Changqing.Li <at> windriver.com>
Subject: running make failed when perl is installed in the very long path
Date: Thu, 21 Nov 2024 02:56:29 +0000
[Message part 1 (text/plain, inline)]
Hi,  Dear Maintainers

I met an  issue when try to compile automake with the perl installed in a very long path which larger then max length of shebang ,  here is the reproduce steps

  1.
git clone git <at> github.com:autotools-mirror/automake.git; cd automake
  2.
./bootstrap
  3.
./configure
  4.
make
Failed with error:
...
GEN      doc/aclocal-1.17.1
help2man: can't get `--help' info from bin/aclocal
Try `--no-discard-stderr' if option outputs to stderr
make: *** [Makefile:3818: doc/aclocal-1.17.1] Error 2

The failure is caused by the long path of the perl in aclocal.in,  the shebang  is cutted.  Could we change it like following diff?
diff --git a/bin/aclocal.in b/bin/aclocal.in
index 4d01f3a4d..73d5ee47f 100644
--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -1,4 +1,4 @@
-#!@PERL@
+#!/usr/bin/env perl
 # aclocal - create aclocal.m4 by scanning configure.ac      -*- perl -*-
 # @configure_input@
 # Copyright (C) 1996-2024 Free Software Foundation, Inc.
diff --git a/bin/automake.in b/bin/automake.in
index 479125505..55985ea34 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -1,4 +1,4 @@
-#!@PERL@
+#!/usr/bin/env perl
 # automake - create Makefile.in from Makefile.am            -*- perl -*-
 # @configure_input@
 # Copyright (C) 1994-2024 Free Software Foundation, Inc.

Thank you,
Changqing
[Message part 2 (text/html, inline)]

Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Thu, 21 Nov 2024 04:54:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Collin Funk <collin.funk1 <at> gmail.com>
To: "Li, Changqing" via Bug reports for Automake <bug-automake <at> gnu.org>
Cc: "Li, Changqing" <Changqing.Li <at> windriver.com>, 74453 <at> debbugs.gnu.org,
 Bruno Haible <bruno <at> clisp.org>
Subject: Re: bug#74453: running make failed when perl is installed in the
 very long path
Date: Wed, 20 Nov 2024 20:53:02 -0800
Hi,

"Li, Changqing" via Bug reports for Automake <bug-automake <at> gnu.org>
writes:

> I met an  issue when try to compile automake with the perl installed in a very long path which larger then max length of shebang ,  here is the reproduce steps

What shell cut off the path? Seems like a bug in that shell.

As Bruno Haible said in a Gnulib thread [1]:

> "#!/usr/bin/env perl" does not work on GuixSD (where the only program
> that has a hardcoded file name is /bin/sh; there is no /usr and no
> /bin/env on this distro).

So I don't think it would work in this case.

Collin

[1] https://lists.gnu.org/archive/html/bug-gnulib/2019-06/msg00022.html




Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Thu, 21 Nov 2024 04:55:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Thu, 21 Nov 2024 04:58:02 GMT) Full text and rfc822 format available.

Message #14 received at 74453 <at> debbugs.gnu.org (full text, mbox):

From: Nick Bowler <nbowler <at> draconx.ca>
To: "Li, Changqing" <Changqing.Li <at> windriver.com>
Cc: 74453 <at> debbugs.gnu.org
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Wed, 20 Nov 2024 23:56:29 -0500
On 2024-11-20 21:56, Li, Changqing via Bug reports for Automake wrote:
> The failure is caused by the long path of the perl in aclocal.in,  the
> shebang  is cutted.  Could we change it like following diff?  
> [...]
> -#!@PERL@
> +#!/usr/bin/env perl

Hardcoding program names like this isn't really going to work well as a
general solution.

I was going to suggest you could just configure for your system with:

  ./configure PERL='/usr/bin/env perl'

and it will substitute that into the scripts for you, but the configure
script in Automake 1.17 exits with a fatal error if it determines that
$PERL contains spaces.  We should probably make this non fatal since the
check is clearly too broad.  You can patch configure to not exit:

--- configure~
+++ configure
@@ -3514,7 +3514,7 @@ case $PERL in
    as_fn_error $? "perl not found" "$LINENO" 5
    ;;
  *' '* | *'	'*)
-  as_fn_error $? "The path to your Perl contains spaces or tabs.
+:  as_fn_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." "$LINENO" 5
   ;;

and then it will let you set PERL='/usr/bin/env perl' and it will work.

Hope that helps,
  Nick




Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Thu, 21 Nov 2024 05:16:02 GMT) Full text and rfc822 format available.

Message #17 received at 74453 <at> debbugs.gnu.org (full text, mbox):

From: Nick Bowler <nbowler <at> draconx.ca>
To: Collin Funk <collin.funk1 <at> gmail.com>
Cc: bruno <at> clisp.org, Changqing.Li <at> windriver.com, 74453 <at> debbugs.gnu.org
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Thu, 21 Nov 2024 00:14:08 -0500
On 2024-11-20 23:53, Collin Funk wrote:
> "Li, Changqing" via Bug reports for Automake <bug-automake <at> gnu.org>
> writes:
> 
>> I met an  issue when try to compile automake with the perl installed
>> in a very long path which larger then max length of shebang ,  here
>> is the reproduce steps
> 
> What shell cut off the path? Seems like a bug in that shell.

#! lines are not typically interpreted by the shell.  Behaviour between
systems varies: POSIX leaves the results explicitly unspecified when
you run a script that begins with these two characters.

The Linux program loader expects to find a newline in the first 128
bytes of the file (increased to 256 in recent versions), otherwise
you will get an ENOEXEC error from execve.

Cheers,
  Nick




Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Thu, 21 Nov 2024 08:01:02 GMT) Full text and rfc822 format available.

Message #20 received at 74453 <at> debbugs.gnu.org (full text, mbox):

From: Changqing Li <changqing.li <at> windriver.com>
To: Nick Bowler <nbowler <at> draconx.ca>
Cc: 74453 <at> debbugs.gnu.org
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Thu, 21 Nov 2024 16:00:35 +0800
[Message part 1 (text/plain, inline)]
On 11/21/24 12:56, Nick Bowler wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On 2024-11-20 21:56, Li, Changqing via Bug reports for Automake wrote:
>> The failure is caused by the long path of the perl in aclocal.in,  the
>> shebang  is cutted.  Could we change it like following diff?
>> [...]
>> -#!@PERL@
>> +#!/usr/bin/env perl
> Hardcoding program names like this isn't really going to work well as a
> general solution.
>
> I was going to suggest you could just configure for your system with:
>
>    ./configure PERL='/usr/bin/env perl'
>
> and it will substitute that into the scripts for you, but the configure
> script in Automake 1.17 exits with a fatal error if it determines that
> $PERL contains spaces.  We should probably make this non fatal since the
> check is clearly too broad.  You can patch configure to not exit:
>
> --- configure~
> +++ configure
> @@ -3514,7 +3514,7 @@ case $PERL in
>      as_fn_error $? "perl not found" "$LINENO" 5
>      ;;
>    *' '* | *'    '*)
> -  as_fn_error $? "The path to your Perl contains spaces or tabs.
> +:  as_fn_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." "$LINENO" 5
>     ;;
>
> and then it will let you set PERL='/usr/bin/env perl' and it will work.

@Nick,  Thanks for your help.

Regards

Changqing

>
> Hope that helps,
>    Nick
[Message part 2 (text/html, inline)]

Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Fri, 22 Nov 2024 05:12:01 GMT) Full text and rfc822 format available.

Message #23 received at 74453 <at> debbugs.gnu.org (full text, mbox):

From: Changqing Li <changqing.li <at> windriver.com>
To: Nick Bowler <nbowler <at> draconx.ca>
Cc: 74453 <at> debbugs.gnu.org
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Fri, 22 Nov 2024 13:11:23 +0800
[Message part 1 (text/plain, inline)]
On 11/21/24 12:56, Nick Bowler wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On 2024-11-20 21:56, Li, Changqing via Bug reports for Automake wrote:
>> The failure is caused by the long path of the perl in aclocal.in,  the
>> shebang  is cutted.  Could we change it like following diff?
>> [...]
>> -#!@PERL@
>> +#!/usr/bin/env perl
> Hardcoding program names like this isn't really going to work well as a
> general solution.
>
> I was going to suggest you could just configure for your system with:
>
>    ./configure PERL='/usr/bin/env perl'
>
> and it will substitute that into the scripts for you, but the configure
> script in Automake 1.17 exits with a fatal error if it determines that
> $PERL contains spaces.  We should probably make this non fatal since the
> check is clearly too broad.

Should we open a bug for this?

//Changqing

> You can patch configure to not exit:
>
> --- configure~
> +++ configure
> @@ -3514,7 +3514,7 @@ case $PERL in
>      as_fn_error $? "perl not found" "$LINENO" 5
>      ;;
>    *' '* | *'    '*)
> -  as_fn_error $? "The path to your Perl contains spaces or tabs.
> +:  as_fn_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." "$LINENO" 5
>     ;;
>
> and then it will let you set PERL='/usr/bin/env perl' and it will work.
>
> Hope that helps,
>    Nick
[Message part 2 (text/html, inline)]

Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Fri, 22 Nov 2024 22:44:01 GMT) Full text and rfc822 format available.

Message #26 received at 74453 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: changqing.li <at> windriver.com
Cc: nbowler <at> draconx.ca, 74453 <at> debbugs.gnu.org
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Fri, 22 Nov 2024 15:43:06 -0700
    Should we open a bug for this?

No need to open a separate bug. I can change AC_MSG_ERROR to
AC_MSG_WARN, and perhaps tweak the message a little. --thanks, karl.




Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Sun, 24 Nov 2024 01:59:02 GMT) Full text and rfc822 format available.

Message #29 received at 74453 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: changqing.li <at> windriver.com
Cc: 74453 <at> debbugs.gnu.org
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Sat, 23 Nov 2024 18:58:28 -0700
    >    ./configure PERL='/usr/bin/env perl'
    >
    > and it will substitute that into the scripts for you, but the configure
    > script in Automake 1.17 exits with a fatal error if it determines that
    > $PERL contains spaces.  We should probably make this non fatal since the
    > check is clearly too broad.

I changed this to a warning. Thanks. -k

-----------------------------------------------------------------------------
configure: make perl path with whitespace a warning, not error.

For https://bugs.gnu.org/74453.
See also https://bugs.gnu.org/62896.

* configure.ac (PERL): use AC_MSG_WARN.
diff --git a/configure.ac b/configure.ac
index e4c7a126c..fb2b37076 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,9 +73,11 @@ case $PERL in
    AC_MSG_ERROR([perl not found])
    ;;
  *' '* | *'	'*)
-  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.])
+  AC_MSG_WARN([The path to your Perl contains spaces or tabs.
+This will likely cause build failures later or unusable programs.
+Unless you're specifying a full string for a #! line,
+as in "/usr/bin/env perl",
+please use a path without spaces and try again.])
   ;;
 esac





Reply sent to Karl Berry <karl <at> freefriends.org>:
You have taken responsibility. (Sun, 24 Nov 2024 01:59:02 GMT) Full text and rfc822 format available.

Notification sent to "Li, Changqing" <Changqing.Li <at> windriver.com>:
bug acknowledged by developer. (Sun, 24 Nov 2024 01:59:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Tue, 26 Nov 2024 09:44:02 GMT) Full text and rfc822 format available.

Message #37 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: "Li, Changqing via Bug reports for Automake" <bug-automake <at> gnu.org>,
 Collin Funk <collin.funk1 <at> gmail.com>
Cc: "Li, Changqing" <Changqing.Li <at> windriver.com>, 74453 <at> debbugs.gnu.org
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Tue, 26 Nov 2024 10:43:19 +0100
Collin Funk cited me:
> As Bruno Haible said in a Gnulib thread [1]:
> 
> > "#!/usr/bin/env perl" does not work on GuixSD (where the only program
> > that has a hardcoded file name is /bin/sh; there is no /usr and no
> > /bin/env on this distro).
> 
> So I don't think it would work in this case.
> 
> Collin
> 
> [1] https://lists.gnu.org/archive/html/bug-gnulib/2019-06/msg00022.html

That was in 2019. Meanwhile, in GuixSD 1.4, both /bin/sh and /usr/bin/env
exist. So, writing

  #!/usr/bin/env perl

is now again the portable way to start a perl script.

Bruno







Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Tue, 26 Nov 2024 09:44:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#74453; Package automake. (Tue, 26 Nov 2024 09:53:02 GMT) Full text and rfc822 format available.

Message #43 received at 74453 <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: Collin Funk <collin.funk1 <at> gmail.com>, Nick Bowler <nbowler <at> draconx.ca>
Cc: 74453 <at> debbugs.gnu.org, Changqing.Li <at> windriver.com
Subject: Re: bug#74453: running make failed when perl is installed in the very
 long path
Date: Tue, 26 Nov 2024 10:52:01 +0100
Nick Bowler wrote:
> The Linux program loader expects to find a newline in the first 128
> bytes of the file (increased to 256 in recent versions), otherwise
> you will get an ENOEXEC error from execve.

My testing indicates:

The first line which specifies the interpreter and interpreter args is limited in length:
  - max. 253 characters on Linux
  - max. 513 characters on macOS
  - max. 1025 characters on NetBSD
  - max. 125 characters on OpenBSD
  - max. 1022 characters on AIX
  - max. 1021 characters on Solaris
On Linux and AIX, characters exceeding this limit are simply cut off by the system.
On macOS, NetBSD, OpenBSD, and Solaris, the script is not executed at all if this line is too long.

Bruno







bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Dec 2024 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 175 days ago.

Previous Next


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