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 performs grep operations based on UI width #16956

Open
satra opened this issue Nov 13, 2024 · 5 comments
Open

terminal performs grep operations based on UI width #16956

satra opened this issue Nov 13, 2024 · 5 comments

Comments

@satra
Copy link

satra commented Nov 13, 2024

Description

image

as seen above the same command gives two different outputs the difference is the width of the

image

Reproduce

  1. open a terminal
  2. run some long command line process that doesn't show the full output when you do ps aux. i.e the output is cut off
  3. grep for something not visible in the default window
  4. then expand window to ensure the ps aux command shows the word you are grepping
  5. rerun the grep

Expected behavior

shell commands should not be dependent on width of terminal

Context

  • Operating System and version: MacOS
  • Browser and version: Arc
  • JupyterLab version: 4.1.0
@satra satra added the bug label Nov 13, 2024
@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label Nov 13, 2024
@holzman
Copy link
Contributor

holzman commented Nov 15, 2024

Is the environment variables COLUMNS set in your terminal? If so, try running
COLUMNS= ps aux | grep 'prepare-blob'

I think this is due to https://github.com/jupyter/terminado/blob/main/terminado/management.py#L210 - not sure if setting the LINES and COLUMNS environment variables are needed any more.

@RRosio
Copy link
Contributor

RRosio commented Nov 19, 2024

Thanks for opening this issue @satra! Do you happen to have any browser extensions enabled? I tried this myself in Arc and Firefox but I was not able to reproduce this in either but I may not be be accurately following the reproduction steps. Maybe attaching a video would also be helpful to make sure we are attempting to reproduce correctly.

@satra
Copy link
Author

satra commented Nov 20, 2024

i think this perhaps demonstrates the phenomena and relates to @holzman 's comment.

jovyan@jupyter-satra:~$ ps aux | grep jupyter
jovyan       296  0.0  0.0   6480  2360 pts/2    S+   03:27   0:00 grep jupyter
jovyan@jupyter-satra:~$ COLUMNS= ps aux | grep jupyter
jovyan         7  0.1  0.0 542636 151464 ?       Sl   02:56   0:02 /opt/conda/bin/python3.11 /opt/conda/bin/jupyterhub-singleuser --ip=0.0.0.0 --allow-root
jovyan       298  0.0  0.0   6480  2324 pts/2    S+   03:27   0:00 grep jupyter
jovyan@jupyter-satra:~$ COLUMNS=20 ps aux | grep jupyter
jovyan       301  0.0  0.0   6480  2320 pts/2    S+   04:47   0:00 grep jupyter
jovyan@jupyter-satra:~$ COLUMNS=200 ps aux | grep jupyter
jovyan         7  0.0  0.0 618432 151624 ?       Sl   02:56   0:03 /opt/conda/bin/python3.11 /opt/conda/bin/jupyterhub-singleuser --ip=0.0.0.0 --allow-root
jovyan       303  0.0  0.0   6480  2320 pts/2    S+   04:47   0:00 grep jupyter
jovyan@jupyter-satra:~$ ```

@andrii-i
Copy link
Contributor

andrii-i commented Nov 26, 2024

To remedy this problem option to disable changing the columns to more than available width of the viewport in terminal extension can be introduced. @satra would you say this would be helpful?

@krassowski
Copy link
Member

krassowski commented Nov 26, 2024

Such an option might need to be implemented in https://github.com/jupyter-server/jupyter_server_terminals and threaded down https://github.com/jupyter/terminado

@andrii-i andrii-i added enhancement tag:Settings and removed bug status:Needs Info status:Needs Triage Applied to new issues that need triage labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants