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 understand @# as empty tag/href in git source and breaks installation #7402

Closed
jsenin opened this issue Nov 26, 2019 · 5 comments · Fixed by #7927
Closed

pip understand @# as empty tag/href in git source and breaks installation #7402

jsenin opened this issue Nov 26, 2019 · 5 comments · Fixed by #7927
Labels
auto-locked Outdated issues that have been locked by automation state: awaiting PR Feature discussed, PR is needed state: needs discussion This needs some more discussion type: enhancement Improvements to functionality

Comments

@jsenin
Copy link

jsenin commented Nov 26, 2019

Environment

  • pip version: 19.3.1
  • Python version: python 3.7.3
  • OS: Debian 10 (buster) linux kernel 4.19.0-6-amd64

Description

When a git url contains a '@#' becomes an empty tag or href, that does not match with any fetched refs or tags and produces a : " fatal: ambiguous argument '': unknown revision or path not in the working tree."

When running into requirements.txt, breaks installation at this repo point

Expected behavior

Ignore the empty tag/href and continues

How to Reproduce

  1. Setup requirements.txt with a source having a '@#' . e.g:
    -e git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg

  2. Then run 'pip install -r requirements.txt'. Installations works

  3. Then run install again and you get the error ... an error occurs
    fatal: ambiguous argument '': unknown revision or path not in the working tree.

cat requirements.txt 
-e git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg

(j2f) jorge@debian:~/projects/personal/j2f $ pip install -r requirements.txt 
Obtaining py_pkg from git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg (from -r requirements.txt (line 1))
  Cloning https://github.com/AlexIoannides/py-package-template.git to /home/jorge/.virtualenvs/j2f/src/py-pkg
  Running command git clone -q https://github.com/AlexIoannides/py-package-template.git /home/jorge/.virtualenvs/j2f/src/py-pkg
  WARNING: Generating metadata for package py-pkg produced metadata for project name py-package-template. Fix your #egg=py-pkg fragments.
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/9b/af/4fc72f9d38e43b092e91e5b8cb9956d25b2e3ff8c75aed95df5569e4734e/numpy-1.17.4-cp37-cp37m-manylinux1_x86_64.whl (20.0MB)
     |████████████████████████████████| 20.0MB 6.6MB/s 
Collecting requests
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Using cached https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl
Collecting certifi>=2017.4.17
  Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: numpy, idna, urllib3, certifi, chardet, requests, py-package-template
  Running setup.py develop for py-package-template
Successfully installed certifi-2019.9.11 chardet-3.0.4 idna-2.8 numpy-1.17.4 py-package-template requests-2.22.0 urllib3-1.25.7

(j2f) jorge@debian:~/projects/personal/j2f $ pip install -r requirements.txt 
Obtaining py_pkg from git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg (from -r requirements.txt (line 1))
  Updating /home/jorge/.virtualenvs/j2f/src/py-pkg clone
  Running command git fetch -q --tags
  WARNING: Did not find branch or tag '', assuming revision or ref.
  Running command git reset --hard -q ''
  fatal: ambiguous argument '': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
ERROR: Command errored out with exit status 128: git reset --hard -q '' Check the logs for full command output.
@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Nov 26, 2019
@uranusjr
Copy link
Member

But why would the URL have such a combination? I feel the current behaviour is quite reasonable, and it’s up to the user to fix the URL.

@jsenin
Copy link
Author

jsenin commented Nov 27, 2019

But why would the URL have such a combination?

Due a human mistake

I feel the current behaviour is quite reasonable, and it’s up to the user to fix the URL.

Well, it could be repaired by the user, but the user must know what is happening. The output message is very confusing.

@chrahunt
Copy link
Member

Hi @jsenin, thanks for bringing this up.

If the revision part of the URL is empty then instead of continuing we could abort with an error message like:

The URL git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg (from requirements.txt) has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.

Is that what you're looking for?

@chrahunt chrahunt added state: needs discussion This needs some more discussion type: enhancement Improvements to functionality labels Nov 27, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Nov 27, 2019
@chrahunt chrahunt added this to the Print Better Error Messages milestone Nov 27, 2019
@jsenin
Copy link
Author

jsenin commented Nov 27, 2019 via email

@deveshks
Copy link
Contributor

deveshks commented Mar 29, 2020

Hi @pradyunsg , @chrahunt ,

I have raised a PR for the same (#7927). Please have a look :)

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 5, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation state: awaiting PR Feature discussed, PR is needed state: needs discussion This needs some more discussion type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants