This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients dstufft, eric.araujo, serhiy.storchaka, xtreak
Date 2018-09-27.02:46:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538016418.91.0.545547206417.issue31551@psf.upfronthosting.co.za>
In-reply-to
Content
There is a similar issue with whitespace in filenames causing failure in bdist_rpm tracked at issue809163. It has test cases but unfortunately the issue didn't move forward and has only patches. I tried the patches but none of them seem to fix the issue here. The issue seems to be in spec file generation with space in path of python executable. Did some debugging and my analysis as follows. Renamed my source directory 'cpython' as 'cpy thon' and made a clean build. It seems that sys.executable returns '/home/karthi/cpy thon/python' which is used as the python binary for the commands and hence with normal string concatenation the spec file generated [0] . I tried very basic fix of sys.executable.replace(' ', '\ ') to be used as a path. It generates the correct spec file [1] which passes and ./python -m test -vuall test_distutils also passes.

I am not sure if Python has a function to escape spaces for shell commands which would be more reliable. I tried shlex.quote but it handles only ' and ". I think having space in the directory might cause issues in places where we use string concatenation with sys.executable without taking spaces into account like the other issue with windows. I will try running the test suite sometime with space.

[0] With spaces. The commands that fail are /home/karthi/cpy thon/python setup.py build and /home/karthi/cpy thon/python setup.py install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES

%define name foo
%define version 0.1
%define unmangled_version 0.1
%define release 1

Summary: UNKNOWN
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
License: UNKNOWN
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: xxx <xxx>
Url: xxx

%description
UNKNOWN

%prep
%setup -n %{name}-%{unmangled_version}

%build
/home/karthi/cpy thon/python setup.py build

%install
/home/karthi/cpy thon/python setup.py install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES

%clean
rm -rf $RPM_BUILD_ROOT

%files -f INSTALLED_FILES
%defattr(-,root,root)


[1] sys.executable.replace(' ', '\ ') and the tests pass


%define name foo
%define version 0.1
%define unmangled_version 0.1
%define release 1

Summary: UNKNOWN
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
License: UNKNOWN
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: xxx <xxx>
Url: xxx

%description
UNKNOWN

%prep
%setup -n %{name}-%{unmangled_version}

%build
/home/karthi/cpy\ thon/python setup.py build

%install
/home/karthi/cpy\ thon/python setup.py install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES

%clean
rm -rf $RPM_BUILD_ROOT

%files -f INSTALLED_FILES
%defattr(-,root,root)


I am adding 3.8 also as a target as part of triaging this issue.

Thanks
History
Date User Action Args
2018-09-27 02:46:59xtreaksetrecipients: + xtreak, eric.araujo, serhiy.storchaka, dstufft
2018-09-27 02:46:58xtreaksetmessageid: <1538016418.91.0.545547206417.issue31551@psf.upfronthosting.co.za>
2018-09-27 02:46:58xtreaklinkissue31551 messages
2018-09-27 02:46:58xtreakcreate