Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip show package_name --files lists files incorrectly #10204

Closed
1 task done
mallamanis opened this issue Jul 25, 2021 · 2 comments · Fixed by #10206
Closed
1 task done

pip show package_name --files lists files incorrectly #10204

mallamanis opened this issue Jul 25, 2021 · 2 comments · Fixed by #10206
Assignees
Labels
C: list/show 'pip list' or 'pip show' type: bug A confirmed bug or unintended behavior
Milestone

Comments

@mallamanis
Copy link

Description

When running pip show package_name --files the file paths returned are invalid paths. Specifically the prefix is the relative path between the site-packages and the current working directory.

For example:

$ pip show requests --files
Name: requests
Version: 2.26.0
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: /home/miallama/pip-bug-replication/lib/python3.8/site-packages
Requires: idna, urllib3, charset-normalizer, certifi
Required-by:
Files:
  ../../../../requests-2.26.0.dist-info/INSTALLER
  ../../../../requests-2.26.0.dist-info/LICENSE
  ../../../../requests-2.26.0.dist-info/METADATA
  ../../../../requests-2.26.0.dist-info/RECORD
  ../../../../requests-2.26.0.dist-info/WHEEL
  ../../../../requests-2.26.0.dist-info/top_level.txt
  ../../../../requests/__init__.py
  ../../../../requests/__pycache__/__init__.cpython-38.pyc
  ../../../../requests/__pycache__/__version__.cpython-38.pyc
  ../../../../requests/__pycache__/_internal_utils.cpython-38.pyc
  ../../../../requests/__pycache__/adapters.cpython-38.pyc
  ../../../../requests/__pycache__/api.cpython-38.pyc
  ../../../../requests/__pycache__/auth.cpython-38.pyc
  ../../../../requests/__pycache__/certs.cpython-38.pyc
  ../../../../requests/__pycache__/compat.cpython-38.pyc
  ../../../../requests/__pycache__/cookies.cpython-38.pyc
  ../../../../requests/__pycache__/exceptions.cpython-38.pyc
  ../../../../requests/__pycache__/help.cpython-38.pyc
  ../../../../requests/__pycache__/hooks.cpython-38.pyc
  ../../../../requests/__pycache__/models.cpython-38.pyc
  ../../../../requests/__pycache__/packages.cpython-38.pyc
  ../../../../requests/__pycache__/sessions.cpython-38.pyc
  ../../../../requests/__pycache__/status_codes.cpython-38.pyc
  ../../../../requests/__pycache__/structures.cpython-38.pyc
  ../../../../requests/__pycache__/utils.cpython-38.pyc
...

Note that ../../../../ is the relative path between site-packages and the current working directory in my run.

I suspect that this line introduced in this commit may be responsible.

Expected behavior

Previously, (e.g. with pip==9.0.1 and pip==21.1) the listed files were relative to the site-packages location.

$ pip show requests --files
Name: requests
Version: 2.26.0
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: /home/miallama/pip-bug-replication/lib/python3.8/site-packages
Requires: idna, certifi, urllib3, charset-normalizer
Files:
  requests-2.26.0.dist-info/INSTALLER
  requests-2.26.0.dist-info/LICENSE
  requests-2.26.0.dist-info/METADATA
  requests-2.26.0.dist-info/RECORD
  requests-2.26.0.dist-info/WHEEL
  requests-2.26.0.dist-info/top_level.txt
  requests/__init__.py
  requests/__pycache__/__init__.cpython-38.pyc
  requests/__pycache__/__version__.cpython-38.pyc
  requests/__pycache__/_internal_utils.cpython-38.pyc
  requests/__pycache__/adapters.cpython-38.pyc
  requests/__pycache__/api.cpython-38.pyc
  requests/__pycache__/auth.cpython-38.pyc
  requests/__pycache__/certs.cpython-38.pyc
  requests/__pycache__/compat.cpython-38.pyc
  requests/__pycache__/cookies.cpython-38.pyc
  requests/__pycache__/exceptions.cpython-38.pyc
  requests/__pycache__/help.cpython-38.pyc
  requests/__pycache__/hooks.cpython-38.pyc
  requests/__pycache__/models.cpython-38.pyc
  requests/__pycache__/packages.cpython-38.pyc
  requests/__pycache__/sessions.cpython-38.pyc
  requests/__pycache__/status_codes.cpython-38.pyc
  requests/__pycache__/structures.cpython-38.pyc
  requests/__pycache__/utils.cpython-38.pyc
  requests/__version__.py
  requests/_internal_utils.py
  requests/adapters.py
  requests/api.py
  requests/auth.py
  requests/certs.py
  requests/compat.py
...

pip version

21.2.1

Python version

3.8

OS

Ubuntu 18.04

How to Reproduce

  1. Install the latest pip
  2. Then run pip show some_package --files
  3. The paths of the listed files are incorrect.

Output

No response

Code of Conduct

@mallamanis mallamanis added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jul 25, 2021
@uranusjr
Copy link
Member

Thanks for the report! I messed up path manipulation in the new logic, and there's apparently no test cases to catch this.

@uranusjr uranusjr added C: list/show 'pip list' or 'pip show' and removed S: needs triage Issues/PRs that need to be triaged labels Jul 26, 2021
@uranusjr uranusjr added this to the 21.2.2 milestone Jul 26, 2021
@uranusjr uranusjr self-assigned this Jul 26, 2021
@uranusjr
Copy link
Member

Fix submitted in #10206.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: list/show 'pip list' or 'pip show' type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants