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

VCS invocation merges stdout and stderr, resulting in output parsing error #7545

Closed
tomprince opened this issue Jan 2, 2020 · 7 comments · Fixed by #7969
Closed

VCS invocation merges stdout and stderr, resulting in output parsing error #7545

tomprince opened this issue Jan 2, 2020 · 7 comments · Fixed by #7969
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@tomprince
Copy link

tomprince commented Jan 2, 2020

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.

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Jan 2, 2020
@sbidoul
Copy link
Member

sbidoul commented Jan 3, 2020

It's correct that pip captures both stdout and stderr:

proc = subprocess.Popen(
# Convert HiddenText objects to the underlying str.
reveal_command_args(cmd),
stderr=subprocess.STDOUT, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, cwd=cwd, env=env,
)

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

@sbidoul sbidoul added the S: awaiting response Waiting for a response/more information label Jan 4, 2020
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jan 4, 2020
@tomprince
Copy link
Author

It does not appear to silence the warning.

@no-response no-response bot removed the S: awaiting response Waiting for a response/more information label Jan 9, 2020
@uranusjr
Copy link
Member

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

@pradyunsg pradyunsg added the S: needs triage Issues/PRs that need to be triaged label Feb 21, 2020
@uranusjr uranusjr changed the title pip freeze fails if there is an editable install, and hg root has a warning VCS invocation merges stdout and stderr, resulting in output parsing error May 4, 2020
@uranusjr
Copy link
Member

uranusjr commented May 4, 2020

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

@godlygeek
Copy link
Contributor

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 0cb2991 stderr was redirected to stdout to add the ability to filter tracebacks from stderr, and when that traceback filtering functionality was removed in f9429b0 stderr wasn't split back apart from stdout.

@deveshks
Copy link
Contributor

deveshks commented May 5, 2020

I think this is similar to what I observed in svn in #7968 .

I have also created a PR for this (#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?

@deveshks
Copy link
Contributor

Hi @tomprince

The fix for this #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?

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 24, 2020
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jun 24, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 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
Projects
None yet
6 participants