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 jaraco
Recipients jaraco, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-08-08.17:34:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1596908077.96.0.398710638995.issue41509@roundup.psfhosted.org>
In-reply-to
Content
On Windows:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ntpath 
>>> ntpath.relpath('foo ', 'foo')
'.'

On macOS:

Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ntpath
>>> ntpath.relpath('foo ', 'foo')
'..\\foo '


I stumbled into this issue when troubleshooting an [issue in a Setuptools PR](https://github.com/pypa/setuptools/pull/2305#issuecomment-670946965).

I suspect the Windows version is using some API that strips whitespace from the filename before performing a relative path. However, when using relpath to detect characters after a common path, stripping the whitespace can cause problems.

I wouldn't expect Windows to be performing normalization of paths in relpath, but it seems it does. If this behavior is by design and has a good reason, that behavior should be mirrored in the non-Windows implementation.
History
Date User Action Args
2020-08-08 17:34:38jaracosetrecipients: + jaraco, paul.moore, tim.golden, zach.ware, steve.dower
2020-08-08 17:34:37jaracosetmessageid: <1596908077.96.0.398710638995.issue41509@roundup.psfhosted.org>
2020-08-08 17:34:37jaracolinkissue41509 messages
2020-08-08 17:34:37jaracocreate