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

Importing bash history is still prone to hanging #7874

Closed
sersorrel opened this issue Mar 28, 2021 · 1 comment
Closed

Importing bash history is still prone to hanging #7874

sersorrel opened this issue Mar 28, 2021 · 1 comment
Labels
bug Something that's not working as intended
Milestone

Comments

@sersorrel
Copy link

  • fish 3.2.1
  • Ubuntu 18.04, amd64
  • kitty 0.19.3

When I run fish, it hangs at 100% CPU, and doesn't respond to SIGINT. If I move ~/.bash_history elsewhere, it starts up fine.

This seems similar to e.g. #7407 and #7497, but both of those issues appear fixed in fish 3.2.1.

My bash history is ~2.6MB, just under 95k lines long (though a little under 10k of those are HISTTIMEFORMAT comments).

I believe the problematic command (or, one of the problematic commands) is this one:

jq <<"EOF"
[{"background":null,"color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3c3836","full_text":"  141.57 GiB ","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3C3836FF","full_text":" ","markup":"pango","name":"e49dcba19c99470ca906c84bd7e2d26c","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3c3836","full_text":"   ","markup":"pango","name":"628b16c2ef8947d2aaab8e976c3eb135","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3C3836FF","full_text":"  5.3/15.5 (34%) ","markup":"pango","name":"memory","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3c3836","full_text":" compositor is already running ","markup":"pango","name":"e4033a10be4a4b05abd714430d0d7441","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#FBF1C7FF","full_text":"   ","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3c3836","full_text":"  43° ","markup":"pango","name":"832500be70604dc485e351d1e552cec6","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3C3836FF","full_text":"  4d 3h ","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3c3836","full_text":"  n/a ","markup":"pango","name":"b3d7736948aa4c22a9392ec46715f160","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#00000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#00000000","color":"#3C3836FF","full_text":" Monday 2019-07-15 10:51 pm ","markup":"pango","name":"7ac94d496c354d7d82734fb7bd9d6e3d","separator":false,"separator_block_width":0}]
EOF

The problem seems to be specific to the JSON – a history file containing a heredoc of 4kb of aaaaaaaa causes no issues.

@faho
Copy link
Member

faho commented Mar 28, 2021

The issue here is that there is no way for fish to tell that's a multi-line construct.

The first line fails parsing, but since fish doesn't have heredocs the second line is looked at separately, and that then possibly causes some combinatoric explosion.

The solution is to tighten the checks for history import further.

@faho faho closed this as completed in 4e4852c Mar 28, 2021
@faho faho added the bug Something that's not working as intended label Mar 28, 2021
@faho faho added this to the fish 3.3.0 milestone Mar 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants