pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.36k stars 2.98k forks source link

split_leading_dir gives an incorrect result on a bare filename #12798

Closed pfmoore closed 5 days ago

pfmoore commented 5 days ago

When passed a bare filename, pip._internal.utils.unpacking.split_leading_dir returns a 2-element list with the first part being the filename supplied. This is backwards - the first part is meant to be the leading directory.

This doesn't currently trigger a bug because split_leading_dir isn't ever called in a situation where the argument is a bare filename (except in has_leading_dir, where the bug is extremely unlikely to give an incorrect result). But it's worth fixing in case this ever changes.

pfmoore commented 5 days ago

Doh, never mind. This is causing a load of test failures. I still think this looks wrong, but I don't have the time to dig any deeper right now, and it's not causing any actual issues, so I'm just going to close this PR.