Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkpport adds quotes to $perl even if it's already quoted #15574

Open
p5pRT opened this issue Aug 31, 2016 · 8 comments
Open

mkpport adds quotes to $perl even if it's already quoted #15574

p5pRT opened this issue Aug 31, 2016 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 31, 2016

Migrated from rt.perl.org#129152 (status was 'open')

Searchable as RT129152$

@p5pRT
Copy link
Author

p5pRT commented Aug 31, 2016

From @briandfoy

I'm compiling 5.25.4 from a path with a space character in it. It fails from a double double quoting issue that tries to run a command like​:

  ""/Path/To Some/Place/perl"" ...

which_perl from MakeMaker​::Test​::Utils returns a path already quoted, like q("/Path/To Some/Place/perl"). The run subroutine in mkpport checks for whitespace in $perl and adds another layer of double quotes around the string if it finds whitespace. It should only do that if the value doesn't already have those quotes.

@p5pRT
Copy link
Author

p5pRT commented Aug 31, 2016

From @jkeenan

On Wed Aug 31 07​:38​:33 2016, comdog wrote​:

I'm compiling 5.25.4 from a path with a space character in it. It
fails from a double double quoting issue that tries to run a command
like​:

""/Path/To Some/Place/perl"" ...

which_perl from MakeMaker​::Test​::Utils returns a path already quoted,
like q("/Path/To Some/Place/perl"). The run subroutine in mkpport
checks for whitespace in $perl and adds another layer of double quotes
around the string if it finds whitespace. It should only do that if
the value doesn't already have those quotes.

So, to confirm this problem, I created this directory​:

#####
/home/jkeenan/Downloads/My Subdir
#####

... got the tarball for perl-5.25.4, unpacked it and moved into the unpacked directory, configured perl and called 'make -j${TEST_JOBS} test_prep' as I would normally do with blead. 'make' silently terminated at this point​:

#####
Making pod file
Making test script
Updating 'mktables.lst'
#####

When I then called 'make', 'make' terminated with this error output​:

#####
./miniperl -Ilib mkppport
running ""/home/jkeenan/Downloads/My Subdir/perl-5.25.4/miniperl"" -I../../lib PPPort_pm.PL
sh​: 1​: /home/jkeenan/Downloads/My​: not found
""/home/jkeenan/Downloads/My Subdir/perl-5.25.4/miniperl"" -I../../lib PPPort_pm.PL failed​: 32512
makefile​:402​: recipe for target 'makeppport' failed
make​: *** [makeppport] Error 2
#####

Is that the error output you're getting?

Thank you very much.
Jim Keenan
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Aug 31, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Aug 31, 2016

From @craigberry

On Wed, Aug 31, 2016 at 11​:43 AM, James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

On Wed Aug 31 07​:38​:33 2016, comdog wrote​:

I'm compiling 5.25.4 from a path with a space character in it. It
fails from a double double quoting issue that tries to run a command
like​:

""/Path/To Some/Place/perl"" ...

which_perl from MakeMaker​::Test​::Utils returns a path already quoted,
like q("/Path/To Some/Place/perl"). The run subroutine in mkpport
checks for whitespace in $perl and adds another layer of double quotes
around the string if it finds whitespace. It should only do that if
the value doesn't already have those quotes.

So, to confirm this problem, I created this directory​:

Since you've got a test set-up handy, try replacing this line

  my $run = $perl =~ m/\s/ ? qq("$perl") : $perl;

from​:

http​://perl5.git.perl.org/perl.git/blob/HEAD​:/mkppport#l140

with

  my $run = ($perl !~ m/^\"/) && ($perl =~ m/\s/) ? qq("$perl") : $perl;

and see if that prevents the double quoting.

@p5pRT
Copy link
Author

p5pRT commented Sep 1, 2016

From @jkeenan

On Wed Aug 31 10​:17​:28 2016, craig.a.berry@​gmail.com wrote​:

On Wed, Aug 31, 2016 at 11​:43 AM, James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

On Wed Aug 31 07​:38​:33 2016, comdog wrote​:

I'm compiling 5.25.4 from a path with a space character in it. It
fails from a double double quoting issue that tries to run a command
like​:

""/Path/To Some/Place/perl"" ...

which_perl from MakeMaker​::Test​::Utils returns a path already quoted,
like q("/Path/To Some/Place/perl"). The run subroutine in mkpport
checks for whitespace in $perl and adds another layer of double quotes
around the string if it finds whitespace. It should only do that if
the value doesn't already have those quotes.

So, to confirm this problem, I created this directory​:

Since you've got a test set-up handy, try replacing this line

my $run = $perl =~ m/\s/ ? qq("$perl") : $perl;

from​:

http​://perl5.git.perl.org/perl.git/blob/HEAD​:/mkppport#l140

with

my $run = ($perl !~ m/^\"/) && ($perl =~ m/\s/) ? qq("$perl") : $perl;

and see if that prevents the double quoting.

Substituting in that one line, 'make' completes successfully. However, there are massive test failures. Here is a taste of those​:

#####
t/base/term .................................................... sh​: 1​: /home/jkeenan/Downloads/My​: not found
FAILED at test 2
t/base/translate ............................................... ok
[snip]
t/run/cloexec .................................................. # Failed test 3 - child stdout​: has 1 newline (rc=127, should be non-zero) at run/cloexec.t line 98
# got "0"
# expected == "1"
# Failed test 4 - child stdout​: fd at run/cloexec.t line 100
# got ""
# expected "childfd=3\n"
sh​: 1​: /home/jkeenan/Downloads/My​: not found
# Failed test 7 - child return code=127 (zero means inherited fd=3 ok) at run/cloexec.t line 109
# got "127"
# expected == "0"
# Failed test 8 - child stdout​: has 2 newlines at run/cloexec.t line 112
# got "0"
# expected == "2"
# Failed test 9 - child stdout​: split into 2 lines at run/cloexec.t line 113
# got "0"
# expected == "2"
# Failed test 10 - child stdout​: fd at run/cloexec.t line 114
# got undef
# expected "childfd=3\n"
# Failed test 11 - child stdout​: line 1 at run/cloexec.t line 115
# got undef
# expected "tmpfile1 line 1\n"
# Failed test 14 - child stdout​: has 1 newline (rc=127, should be non-zero) at run/cloexec.t line 98
# got "0"
# expected == "1"
# Failed test 15 - child stdout​: fd at run/cloexec.t line 100
# got ""
# expected "childfd=4\n"
sh​: 1​: /home/jkeenan/Downloads/My​: not found
# Failed test 18 - child return code=127 (zero means inherited fd=4 ok) at run/cloexec.t line 109
# got "127"
# expected == "0"
# Failed test 19 - child stdout​: has 2 newlines at run/cloexec.t line 112
# got "0"
# expected == "2"
# Failed test 20 - child stdout​: split into 2 lines at run/cloexec.t line 113
# got "0"
# expected == "2"
# Failed test 21 - child stdout​: fd at run/cloexec.t line 114
# got undef
# expected "childfd=4\n"
# Failed test 22 - child stdout​: line 1 at run/cloexec.t line 115
# got undef
# expected "tmpfile1 line 1\n"
FAILED at test 3
t/run/dtrace ................................................... skipped

#####

I tried similar replacements this morning and got similar results.

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Apr 26, 2017

From @briandfoy

I patched my 5.25.12 sources with this​:

$ diff mkppport mkppport.new
140c140,145
< my $run = $perl =~ m/\s/ ? qq("$perl") : $perl;


my $run = do {
# something is already quoting $perl
if ($perl =~ m/\A".+"\z/ or $perl !~ m/\s/ ) { $perl }
else { qq("$perl") }
};

That solves the first problem.

@p5pRT
Copy link
Author

p5pRT commented Apr 26, 2017

From @jkeenan

On Wed, 26 Apr 2017 20​:08​:24 GMT, comdog wrote​:

I patched my 5.25.12 sources with this​:

$ diff mkppport mkppport.new
140c140,145
< my $run = $perl =~ m/\s/ ? qq("$perl") : $perl;
---

my $run = do {
# something is already quoting $perl
if ($perl =~ m/\A".+"\z/ or $perl !~ m/\s/ ) { $perl }
else { qq("$perl") }
};

That solves the first problem.

And ... is there a second problem?
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Apr 26, 2017

From @briandfoy

A second problem besides all the test failures you've already noted?
Probably, but not that I've found yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants