Hacker News new | ask | show | jobs
by MereInterest 720 days ago
Because like industrial waste, Windows exports problems to other systems.

1. Windows has an absurdly short maximum path length of 260 characters.

2. On Windows, moving files to a temporary directory can fail, if the temporary directory has a longer prefix than the original path.

3. When uninstalling, the python utility "pip" first collects files into a temporary directory, then deletes that temporary directory.

4. To avoid running into MAX_PATH limits, pip doesn't use a normal temp directory. Instead, it makes a temporary directory adjacent to the directory it is removing. (https://github.com/pypa/pip/pull/6029)

5. If pip is interrupted while uninstalling, the adjacent temp directory is never deleted.

So, in order to work around a Windows-only problem, pip stopped using standard file locations, creating a new problem that only existed due to the workaround. And then I'm left trying to figure out why I'm running out of disk space.

2 comments

The MAX_PATH limit is annoying legacy backwards compatible stuff, but can be avoided by prefixing paths with \\?\ before passing them into the Windows API.

This is something that languages/runtimes with more effort put into portability already handle for you:

https://github.com/openjdk/jdk/blob/master/src/java.base/win...

If Python doesn't do this it's just because the sort of people who write Python don't care about Windows enough to fix it.

https://www.cvedetails.com/top-50-products.php

Yeah, I don't see Windows in the top 5.