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

Terminal control codes being output even with "-q" (as of 8.0.0) #3418

Closed
tianon opened this issue Jan 22, 2016 · 6 comments
Closed

Terminal control codes being output even with "-q" (as of 8.0.0) #3418

tianon opened this issue Jan 22, 2016 · 6 comments
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior
Milestone

Comments

@tianon
Copy link

tianon commented Jan 22, 2016

I think examples of output will illustrate the bug far more clearly than I can describe:

$ pip --version
pip 8.0.2 from /usr/local/lib/python3.5/site-packages (python 3.5)
$ pip install -q sh | hexdump -C
00000000  1b 5b 3f 32 35 6c 1b 5b  3f 32 35 68              |.[?25l.[?25h|
0000000c
$ 

Compare to previous (expected) output:

$  pip --version
pip 7.1.2 from /usr/local/lib/python3.5/site-packages (python 3.5)
$ pip install -q sh | hexdump -C
$ 

It's probably also worth noting that piping the output didn't suppress these either (as might also be expected). 👍

(Happy to provide more detail or do more debugging as desired!)

@mattrobenolt
Copy link
Contributor

To add to this, I can't reproduce on OSX. It seems to only be on Linux.

@mattrobenolt
Copy link
Contributor

@xavfernandez xavfernandez added the type: bug A confirmed bug or unintended behavior label Jan 26, 2016
@xavfernandez
Copy link
Member

Bisecting lead to 5bb9899 certainly the contextmanager hidden_cursor that always write the control characters.

cc @njsmith if you have any idea :)

@njsmith
Copy link
Member

njsmith commented Jan 26, 2016

Doh, yes, definitely my fault. Ugh. The interaction between the use of the logging system for output + the desire for fancy terminal display is very nasty and error prone...

I guess hidden_cursor's output should be protected by the incantation

if file.isatty() and logger.getEffectiveLevel() <= logging.INFO: ...

I can make a patch containing the above but I don't know how to write a test for it, so I'd appreciate tips on that. Or given how trivial the fix itself is maybe it'd be quicker just to do it yourself, either way :-)

@frewsxcv
Copy link

frewsxcv commented Feb 1, 2016

Is there anything I can do to help with this? This is preventing everyone (including myself) from using pip 8.x with the Python docker image

njsmith added a commit to njsmith/pip that referenced this issue Feb 1, 2016
Commit 5bb9899 added some code for hiding/showing the cursor when
running on the terminal, but accidentally made it so that it always
printed the invisible control codes, even when not on a tty or when
--quiet was specified. This turns out to be surprisingly bad (e.g. it
breaks the official docker python builds). So, let's not do that.

Fixes pypagh-3418
@njsmith
Copy link
Member

njsmith commented Feb 1, 2016

Submitted a PR.

njsmith added a commit to njsmith/pip that referenced this issue Feb 1, 2016
Commit 5bb9899 added some code for hiding/showing the cursor when
running on the terminal, but accidentally made it so that it always
printed the invisible control codes, even when not on a tty or when
--quiet was specified. This turns out to be surprisingly bad (e.g. it
breaks the official docker python builds). So, let's not do that.

Fixes pypagh-3418
@xavfernandez xavfernandez added this to the 8.0.3 milestone Feb 24, 2016
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
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 type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

5 participants