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

[PATCH] allow make to succeed when builddir path contains spaces #16071

Open
p5pRT opened this issue Jul 9, 2017 · 7 comments
Open

[PATCH] allow make to succeed when builddir path contains spaces #16071

p5pRT opened this issue Jul 9, 2017 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 9, 2017

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

Searchable as RT131723$

@p5pRT
Copy link
Author

p5pRT commented Jul 9, 2017

From @ptolemarch

Created by @ptolemarch

At the moment, it's not possible to build perl in a directory, in Unix,
when
that directory or any of its parents have spaces in their names.
Unfortunately, the build system is fairly diligent at finding such
spaces,
apparently using `readlink -f` or something similar; symlinking the
directory
to a better-behaving path doesn't work.

The proximate problem is that `mkppport` fails. What seems to be
happening is​:
  - `mkppport` uses `which_perl` from
  `cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Utils.pm`
  to find the path to perl, and then, if that path contains spaces,
wraps it in quotes.
  - Unfortunately, `which_perl` already (unconditionally) wraps this path
in
  quotes. (This behavior was introduced into ExtUtils-MakeMaker with
patch
  88e2418 in 2014-Nov-8.)
  - So, paths containing a space will end up as
  ""/path/with a space/""
  And when this is parsed by a shell, the middle part is unquoted.
  - (Ironically, then, /only/ paths with spaces in them end up unquoted.)

This small patch removes the step in `mkppport` that adds these extra
quotes.

Perl Info

Flags:
     category=install
     severity=low
     Type=Patch
     PatchStatus=HasPatch

Site configuration information for perl 5.27.2:

Configured by ptolemarch at Thu Jul  6 00:13:18 EDT 2017.

Summary of my perl5 (revision 5 version 27 subversion 2) configuration:
   Derived from: f3652b5af842cd404a34145b6bf87d85df14add1
   Ancestor: 9927ab6ab90ba710ebd3b027dd97c9fb9cc97623
   Platform:
     osname=linux
     osvers=4.10.0-26-generic
     archname=x86_64-linux
     uname='linux patrick 4.10.0-26-generic #30-ubuntu smp tue jun 27 
09:30:12 utc 2017 x86_64 x86_64 x86_64 gnulinux '
     config_args='-Dusedevel -de'
     hint=previous
     useposix=true
     d_sigaction=define
     useithreads=undef
     usemultiplicity=undef
     use64bitint=define
     use64bitall=define
     uselongdouble=undef
     usemymalloc=n
     default_inc_excludes_dot=define
     bincompat5005=undef
   Compiler:
     cc='cc'
     ccflags ='-fwrapv -fno-strict-aliasing -pipe 
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64'
     optimize='-O2'
     cppflags='-fwrapv -fno-strict-aliasing -pipe 
-fstack-protector-strong -I/usr/local/include'
     ccversion=''
     gccversion='6.3.0 20170406'
     gccosandvers=''
     intsize=4
     longsize=8
     ptrsize=8
     doublesize=8
     byteorder=12345678
     doublekind=3
     d_longlong=define
     longlongsize=8
     d_longdbl=define
     longdblsize=16
     longdblkind=3
     ivtype='long'
     ivsize=8
     nvtype='double'
     nvsize=8
     Off_t='off_t'
     lseeksize=8
     alignbytes=8
     prototype=define
   Linker and Libraries:
     ld='cc'
     ldflags =' -fstack-protector-strong -L/usr/local/lib'
     libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed 
/usr/include/x86_64-linux-gnu /usr/lib /usr/local/lib/../lib 
/lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu 
/usr/lib/../lib /lib /usr/local/lib 
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed 
/usr/include/x86_64-linux-gnu /usr/lib /usr/local/lib 
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed 
/usr/include/x86_64-linux-gnu /usr/lib
     libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
     perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
     libc=libc-2.24.so
     so=so
     useshrplib=false
     libperl=libperl.a
     gnulibc_version='2.24'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs
     dlext=so
     d_dlsymun=undef
     ccdlflags='-Wl,-E'
     cccdlflags='-fPIC'
     lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
     uncommitted-changes
     cf97c377205803ee78d48e1136251131670c2563
     53221369625e52e888037a12fbd598c29e2996d2
     ba1ad970dce56a3e92d4f3c9708591a7a1a421fc
     5daa429945bce761f1714c1c78496ba7d171c741
     61ba992267af93038f513ca5bbede32cae192952
     df5a2a2120b8dedc14cc7bcb60119fbc0437ab0a
     f3652b5af842cd404a34145b6bf87d85df14add1


@INC for perl 5.27.2:
     lib
     /usr/local/lib/perl5/site_perl/5.27.2/x86_64-linux
     /usr/local/lib/perl5/site_perl/5.27.2
     /usr/local/lib/perl5/5.27.2/x86_64-linux
     /usr/local/lib/perl5/5.27.2


Environment for perl 5.27.2:
     HOME=/home/ptolemarch
     LANG=en_US.UTF-8
     LANGUAGE=en_US
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     
PATH=/home/ptolemarch/.rakudobrew/bin:/home/ptolemarch/bin:/home/ptolemarch/.rakudobrew/bin:/home/ptolemarch/bin/work:/opt/kubernetes/platforms/linux/amd64:/opt/android-sdk-update-manager/tools:/opt/android-sdk-update-manager/platform-tools:/usr/local/bin:/usr/local/sbin:/usr/games/bin:/opt/X11/bin:/usr/X11/bin:/usr/bin:/usr/sbin:/bin:/sbin
     PERLBREW_CPAN_MIRROR=http://ftp.wayne.edu/CPAN/
     PERLBREW_HOME=/home/ptolemarch/.perl5/perlbrew
     PERLBREW_ROOT=/home/ptolemarch/.perl5/perlbrew
     PERL_BADLANG (unset)
     PERL_CPANM_OPT=--mirror file:///home/ptolemarch/.perl5/minicpan/ 
--mirror-only
     SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 9, 2017

From @ptolemarch

0001-which_perl-already-adds-quotes-when-necessary.patch
From cf97c377205803ee78d48e1136251131670c2563 Mon Sep 17 00:00:00 2001
From: David Hand <davidhand@davidhand.com>
Date: Fri, 30 Jun 2017 18:26:26 -0400
Subject: [PATCH] which_perl() already adds quotes when necessary

`mkppport` needs the path to the perl binary to be build, which it gets
from the `which_perl()` subroutine from `MakeMaker::Test::Utils`.  This
subroutine already checks for spaces and conditionally wraps the path in
quotes.  Doing it twice effectively undoes the quoting.

This patch should enable `make` to succeed even if path to the build
directory contains spaces.
---
 mkppport | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mkppport b/mkppport
index 9f4fd75a4a..d334fb994a 100644
--- a/mkppport
+++ b/mkppport
@@ -137,7 +137,7 @@ sub readlist
 sub run
 {
   my @args = ("-I" . File::Spec->catdir((File::Spec->updir) x 2, 'lib'), @_);
-  my $run = $perl =~ m/\s/ ? qq("$perl") : $perl;
+  my $run = $perl;
   for (@args) {
     $_ = qq("$_") if $^O eq 'VMS' && /^[^"]/;
     $run .= " $_";
-- 
2.11.0

@p5pRT
Copy link
Author

p5pRT commented Jul 9, 2017

From @jkeenan

On Sun, 09 Jul 2017 06​:09​:04 GMT, davidhand@​davidhand.com wrote​:

This is a bug report for perl from davidhand@​davidhand.com,
generated with the help of perlbug 1.40 running under perl 5.27.2.

-----------------------------------------------------------------
[Please describe your issue here]

At the moment, it's not possible to build perl in a directory, in
Unix,
when
that directory or any of its parents have spaces in their names.
Unfortunately, the build system is fairly diligent at finding such
spaces,
apparently using `readlink -f` or something similar; symlinking the
directory
to a better-behaving path doesn't work.

The proximate problem is that `mkppport` fails. What seems to be
happening is​:
- `mkppport` uses `which_perl` from
`cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Utils.pm`
to find the path to perl, and then, if that path contains spaces,
wraps it in quotes.
- Unfortunately, `which_perl` already (unconditionally) wraps this
path
in
quotes. (This behavior was introduced into ExtUtils-MakeMaker
with
patch
88e2418 in 2014-Nov-8.)
- So, paths containing a space will end up as
""/path/with a space/""
And when this is parsed by a shell, the middle part is unquoted.
- (Ironically, then, /only/ paths with spaces in them end up
unquoted.)

This small patch removes the step in `mkppport` that adds these extra
quotes.

I have a feeling that this has been proposed before, but have not been able to locate the relevant RT number. Does anyone recall that?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 9, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Jul 10, 2017

From @jkeenan

On Sun, 09 Jul 2017 15​:04​:17 GMT, jkeenan wrote​:

On Sun, 09 Jul 2017 06​:09​:04 GMT, davidhand@​davidhand.com wrote​:

This is a bug report for perl from davidhand@​davidhand.com,
generated with the help of perlbug 1.40 running under perl 5.27.2.

-----------------------------------------------------------------
[Please describe your issue here]

At the moment, it's not possible to build perl in a directory, in
Unix,
when
that directory or any of its parents have spaces in their names.
Unfortunately, the build system is fairly diligent at finding such
spaces,
apparently using `readlink -f` or something similar; symlinking the
directory
to a better-behaving path doesn't work.

The proximate problem is that `mkppport` fails. What seems to be
happening is​:
- `mkppport` uses `which_perl` from
`cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Utils.pm`
to find the path to perl, and then, if that path contains spaces,
wraps it in quotes.
- Unfortunately, `which_perl` already (unconditionally) wraps this
path
in
quotes. (This behavior was introduced into ExtUtils-MakeMaker
with
patch
88e2418 in 2014-Nov-8.)
- So, paths containing a space will end up as
""/path/with a space/""
And when this is parsed by a shell, the middle part is unquoted.
- (Ironically, then, /only/ paths with spaces in them end up
unquoted.)

This small patch removes the step in `mkppport` that adds these extra
quotes.

I have a feeling that this has been proposed before, but have not been
able to locate the relevant RT number. Does anyone recall that?

http​://www.nntp.perl.org/group/perl.perl5.porters/2014/10/msg221337.html
# Start of long thread

http​://www.nntp.perl.org/group/perl.perl5.porters/2015/08/msg229692.html
http​://www.nntp.perl.org/group/perl.perl5.porters/2015/09/msg230918.html
# postings from Ivan Pozdeev

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 10, 2017

From @jkeenan

On Mon, 10 Jul 2017 01​:58​:02 GMT, jkeenan wrote​:

On Sun, 09 Jul 2017 15​:04​:17 GMT, jkeenan wrote​:

On Sun, 09 Jul 2017 06​:09​:04 GMT, davidhand@​davidhand.com wrote​:

This is a bug report for perl from davidhand@​davidhand.com,
generated with the help of perlbug 1.40 running under perl 5.27.2.

-----------------------------------------------------------------
[Please describe your issue here]

At the moment, it's not possible to build perl in a directory, in
Unix,
when
that directory or any of its parents have spaces in their names.
Unfortunately, the build system is fairly diligent at finding such
spaces,
apparently using `readlink -f` or something similar; symlinking the
directory
to a better-behaving path doesn't work.

The proximate problem is that `mkppport` fails. What seems to be
happening is​:
- `mkppport` uses `which_perl` from
`cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Utils.pm`
to find the path to perl, and then, if that path contains spaces,
wraps it in quotes.
- Unfortunately, `which_perl` already (unconditionally) wraps this
path
in
quotes. (This behavior was introduced into ExtUtils-MakeMaker
with
patch
88e2418 in 2014-Nov-8.)
- So, paths containing a space will end up as
""/path/with a space/""
And when this is parsed by a shell, the middle part is unquoted.
- (Ironically, then, /only/ paths with spaces in them end up
unquoted.)

This small patch removes the step in `mkppport` that adds these extra
quotes.

I have a feeling that this has been proposed before, but have not been
able to locate the relevant RT number. Does anyone recall that?

http​://www.nntp.perl.org/group/perl.perl5.porters/2014/10/msg221337.html
# Start of long thread

Upon further inspection, the thread above appears not to be relevant.

http​://www.nntp.perl.org/group/perl.perl5.porters/2015/08/msg229692.html
http​://www.nntp.perl.org/group/perl.perl5.porters/2015/09/msg230918.html
# postings from Ivan Pozdeev

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 10, 2017

From @jkeenan

On Mon, 10 Jul 2017 02​:03​:30 GMT, jkeenan wrote​:

On Mon, 10 Jul 2017 01​:58​:02 GMT, jkeenan wrote​:

On Sun, 09 Jul 2017 15​:04​:17 GMT, jkeenan wrote​:

On Sun, 09 Jul 2017 06​:09​:04 GMT, davidhand@​davidhand.com wrote​:

This is a bug report for perl from davidhand@​davidhand.com,
generated with the help of perlbug 1.40 running under perl 5.27.2.

-----------------------------------------------------------------
[Please describe your issue here]

At the moment, it's not possible to build perl in a directory, in
Unix,
when
that directory or any of its parents have spaces in their names.
Unfortunately, the build system is fairly diligent at finding such
spaces,
apparently using `readlink -f` or something similar; symlinking the
directory
to a better-behaving path doesn't work.

The proximate problem is that `mkppport` fails. What seems to be
happening is​:
- `mkppport` uses `which_perl` from
`cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Utils.pm`
to find the path to perl, and then, if that path contains spaces,
wraps it in quotes.
- Unfortunately, `which_perl` already (unconditionally) wraps this
path
in
quotes. (This behavior was introduced into ExtUtils-MakeMaker
with
patch
88e2418 in 2014-Nov-8.)
- So, paths containing a space will end up as
""/path/with a space/""
And when this is parsed by a shell, the middle part is unquoted.
- (Ironically, then, /only/ paths with spaces in them end up
unquoted.)

This small patch removes the step in `mkppport` that adds these extra
quotes.

I have a feeling that this has been proposed before, but have not been
able to locate the relevant RT number. Does anyone recall that?

http​://www.nntp.perl.org/group/perl.perl5.porters/2014/10/msg221337.html
# Start of long thread

Upon further inspection, the thread above appears not to be relevant.

http​://www.nntp.perl.org/group/perl.perl5.porters/2015/08/msg229692.html
http​://www.nntp.perl.org/group/perl.perl5.porters/2015/09/msg230918.html
# postings from Ivan Pozdeev

This RT may also be relevant​:

https://rt-archive.perl.org/perl5/Ticket/Display.html?id=129152

--
James E Keenan (jkeenan@​cpan.org)

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

No branches or pull requests

2 participants