Originally triaged in https://github.com/pypa/pip/issues/8164 We are using `0o777 - current_umask()` to set file permissions, but we should be using a Bitwise AND (`0o777 & ~current_umask()`) https://github.com/pypa/pip/blob/43426eea344c626153efa46f3a9bc6b62d7e8a69/src/pip/_internal/utils/unpacking.py#L148 https://github.com/pypa/pip/blob/43426eea344c626153efa46f3a9bc6b62d7e8a69/src/pip/_internal/utils/unpacking.py#L232 We would also want to move the two `os.chmod` calls into a helper function.