Re: [bug #53201] Target runs incorrect command when shebang line exceeds kernel limit

2018-03-17 Thread Casey McGinty
Interesting observation but I don’t follow how that is related to this
issue. The interpreter is not yet running in this case.


On March 17, 2018 at 10:12:54 AM, Brian Vandenberg (
phantall+gnum...@gmail.com) wrote:

  I cannot remark on pip specifically, but some script interpreters seem to
ignore the shebang line if the script is passed as an argument:

$ cat /tmp/blah.sh
#!/bin/bash
printf( "%s:%d\n", __FILE__, __LINE__ );
$ /tmp/blah.sh
/tmp/blah.sh: line 2: syntax error near unexpected token `"%s:%d\n",'
/tmp/blah.sh: line 2: `printf( "%s:%d\n", __FILE__, __LINE__ );'
$ perl /tmp/blah.sh
/tmp/blah.sh: line 2: syntax error near unexpected token `"%s:%d\n",'
/tmp/blah.sh: line 2: `printf( "%s:%d\n", __FILE__, __LINE__ );'

>From the above it's apparent that perl (without extra args) obeys the
shebang line; ditto for ruby (example omitted).  This next example
demonstrates that bash (versions 3.2 and 4.3.33) does not:

$ cat /tmp/stuff.sh
#!/usr/bin/perl
printf( "%s:%d\n", __FILE__, __LINE__ );
$ /tmp/stuff.sh
/tmp/stuff.sh:2
$ bash /tmp/stuff.sh
/tmp/stuff.sh: line 2: syntax error near unexpected token `"%s:%d\n",'
/tmp/stuff.sh: line 2: `printf( "%s:%d\n", __FILE__, __LINE__ );'

I've omitted the text, but I ran the same test with sh, csh, tcsh, zsh and
python.

In summary, when the script is passed as an argument to interpreter:

obeyed shebang: perl, ruby
ignored shebang: sh, csh, tcsh, zsh, bash, python

-brian


On Thu, Feb 22, 2018 at 6:16 AM, David Boyce 
wrote:

> On Thu, Feb 22, 2018 at 4:42 AM,  wrote:
>
>> Casey McGinty writes:
>>  > Follow-up Comment #2, bug #53201 (project make):
>>  >
>>  > See http://man7.org/linux/man-pages/man2/execve.2.html
>>  >
>>  > *A maximum line length of 127 characters is allowed for the first line
>> in an
>>  > interpreter script.*
>>
>>  I think this is referring to the '#!' line of a script, not internal
>>  kernel limits.  This limitation should not affect Gnu Make recipes.
>>
>
> Well, the #! limit is a kernel limit too. But your point that it shouldn't
> affect GNU make recipes (directly) is a good one since make invokes recipes
> via "/bin/sh -c recipe" without ever using a shebang. I have to admit I'm a
> little lost on where the shebang limit is coming in here but it does seem
> to be somehow.
>
>
> ___
> Bug-make mailing list
> Bug-make@gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-make
>
>
___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: [bug #53201] Target runs incorrect command when shebang line exceeds kernel limit

2018-03-17 Thread Brian Vandenberg
  I cannot remark on pip specifically, but some script interpreters seem to
ignore the shebang line if the script is passed as an argument:

$ cat /tmp/blah.sh
#!/bin/bash
printf( "%s:%d\n", __FILE__, __LINE__ );
$ /tmp/blah.sh
/tmp/blah.sh: line 2: syntax error near unexpected token `"%s:%d\n",'
/tmp/blah.sh: line 2: `printf( "%s:%d\n", __FILE__, __LINE__ );'
$ perl /tmp/blah.sh
/tmp/blah.sh: line 2: syntax error near unexpected token `"%s:%d\n",'
/tmp/blah.sh: line 2: `printf( "%s:%d\n", __FILE__, __LINE__ );'

>From the above it's apparent that perl (without extra args) obeys the
shebang line; ditto for ruby (example omitted).  This next example
demonstrates that bash (versions 3.2 and 4.3.33) does not:

$ cat /tmp/stuff.sh
#!/usr/bin/perl
printf( "%s:%d\n", __FILE__, __LINE__ );
$ /tmp/stuff.sh
/tmp/stuff.sh:2
$ bash /tmp/stuff.sh
/tmp/stuff.sh: line 2: syntax error near unexpected token `"%s:%d\n",'
/tmp/stuff.sh: line 2: `printf( "%s:%d\n", __FILE__, __LINE__ );'

I've omitted the text, but I ran the same test with sh, csh, tcsh, zsh and
python.

In summary, when the script is passed as an argument to interpreter:

obeyed shebang: perl, ruby
ignored shebang: sh, csh, tcsh, zsh, bash, python

-brian


On Thu, Feb 22, 2018 at 6:16 AM, David Boyce 
wrote:

> On Thu, Feb 22, 2018 at 4:42 AM,  wrote:
>
>> Casey McGinty writes:
>>  > Follow-up Comment #2, bug #53201 (project make):
>>  >
>>  > See http://man7.org/linux/man-pages/man2/execve.2.html
>>  >
>>  > *A maximum line length of 127 characters is allowed for the first line
>> in an
>>  > interpreter script.*
>>
>>  I think this is referring to the '#!' line of a script, not internal
>>  kernel limits.  This limitation should not affect Gnu Make recipes.
>>
>
> Well, the #! limit is a kernel limit too. But your point that it shouldn't
> affect GNU make recipes (directly) is a good one since make invokes recipes
> via "/bin/sh -c recipe" without ever using a shebang. I have to admit I'm a
> little lost on where the shebang limit is coming in here but it does seem
> to be somehow.
>
>
> ___
> Bug-make mailing list
> Bug-make@gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-make
>
>
___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make