Pip: VCS invocation merges stdout and stderr, resulting in output parsing error

Created on 2 Jan 2020  路  7Comments  路  Source: pypa/pip

Environment

  • pip version: 19.3.1
  • Python version: 2.7
  • OS: fedora

Due to a bug in mercurial, if both the split and evolve extension are enabled, mercurial will output a warning (on stderr) whenever it runs. When pip calls hg root to get the path of an editable install, pip captures both stdout and stderr, and so includes the warning as part of the path to the root of the repository and fails.

This can be reproduced with the following .hgrc:

[extensions]
evolve =
split =

and installing the evolve extensions pip install hg-evolve.

auto-locked

Most helpful comment

I think this is similar to what I observed in svn in https://github.com/pypa/pip/issues/7968 .

I have also created a PR for this (https://github.com/pypa/pip/pull/7969) which removes the behavior of vcs commands of merging stderr and stdout, and makes VCS commands use their own call_subprocess. Could you try it out and see if this fixes the hg issue?

All 7 comments

It's correct that pip captures both stdout and stderr:
https://github.com/pypa/pip/blob/08f61a9b73287dfd155bc72bee0191895cf2819d/src/pip/_internal/utils/subprocess.py#L186-L191

Could you check if running hg --quiet root would silence the warning?

It does not appear to silence the warning.

I鈥檒l probably work on this after #7593. Some refactoring would improve the code touched by that PR, and would fix this bug en passant.

I鈥檝e edited the title to be more generic. This also better reflects the problem (which is general, not limited to hg).

Copying some extra info from #8191:

  1. In the git case this is pretty easy to reproduce by doing an export GIT_TRACE=1
  2. The fact that stderr is redirected to stdout appears to be a historical accident. In 0cb2991cf0ef20f906ad3af67bd08c195d88d826 stderr was redirected to stdout to add the ability to filter tracebacks from stderr, and when that traceback filtering functionality was removed in f9429b0a98a5e193507f8453739d936f13cff412 stderr wasn't split back apart from stdout.

I think this is similar to what I observed in svn in https://github.com/pypa/pip/issues/7968 .

I have also created a PR for this (https://github.com/pypa/pip/pull/7969) which removes the behavior of vcs commands of merging stderr and stdout, and makes VCS commands use their own call_subprocess. Could you try it out and see if this fixes the hg issue?

Hi @tomprince

The fix for this https://github.com/pypa/pip/pull/7969 is now merged to master.

Could you please install pip from master branch (pip install git+https://github.com/pypa/pip.git#egg=master) and verify if the fix works for you?

Was this page helpful?
0 / 5 - 0 ratings