-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fix panic when history size set to 0 #653
Conversation
That's probably a much easier fix than anything else. Thanks! Is it only a problem with FileBackedHistory? or will SqliteBackedHistory also fail with 0? |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #653 +/- ##
==========================================
- Coverage 49.69% 47.41% -2.29%
==========================================
Files 46 47 +1
Lines 8433 9318 +885
==========================================
+ Hits 4191 4418 +227
- Misses 4242 4900 +658
|
Have not tried |
SqliteBackedHistory hasn't been checked yet
df73612
to
8c3787b
Compare
Converting to draft until you can get back to it. |
Looking at the backtrace when setting the capacity to 0 in the
In my view we should properly fix the bug (or define that when given 0 it doesn't try to touch the file). I don't like patching that with a bandaid. |
I will look into it, will have some time this week. |
@andreistan26 Did you ever get time to look into it? |
c0eb2c9
to
1bcd2e2
Compare
Let me know if it looks good, sorry for the delay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to work on this again.
8ec8e9c
to
e5e69ea
Compare
Sorry, I thought this hadn't been updated in a while 😿 |
Imo you should be able to set the history size to 0. |
I think it's ok as long as it doesn't cause panic. |
There's a better chance of landing this PR if the CI is green. @andreistan26 do you have any time to work on this to get the CI green? |
Sure, taking a look at it. |
I am testing the nushell code with reedline set to this ... reedline = { git = "https://github.com/andreistan26/reedline.git", branch = "history_size", features = ["bashisms", "sqlite"] } to see if the bug has been fixed... And it seems like its good... When I set my history in config.nu to the setting below history: {
max_size: 0 # Session has to be reloaded for this to take effect
} I no longer see a crash like I did prior to pointing at your reedline version... |
@andreistan26 can you please merge in the latest reedline code into your branch so its up to date and then I will test out your reedline to make sure on my end all of the tests pass etc... thanks ! |
Signed-off-by: Andrei Stan <[email protected]>
Signed-off-by: Andrei Stan <[email protected]>
fce391b
to
42f9ffa
Compare
Hi @stormasm, the branch is up to date now. thanks |
Just checking, does this work with both FileBackedHistory and SqliteBackedHistory now? |
Sqlite does not have a capacity mechanism. |
So, if you have $env.config.histor.max_size set in nushell and you're using the sqlite file format, the max_size is ignored? |
nushell/nushell#11535 (comment) We are going to have to hold off on landing this PR until we fix a bug with nushell not compiling Once the nushell PR lands --- then I can move forward with testing your PR further... Thanks 😄 |
@stormasm FYI - nushell will still compile, we just have to use |
@fdncred correct ! but I am pointing to the reedline of this PR so I don't think that works ? 😄 |
Did not track how it really works, but looking into the sqlite history file I see no mechanism for limiting the history size. This was also pointed out by @sholderbach. |
@andreistan26 ok we now have a working version of nushell on my branch -> https://github.com/stormasm/nushell/tree/reedline-pr653a that compiles with your reedline changes... And we can test that your code works on nushell when you the history: {
max_size: 0 # Session has to be reloaded for this to take effect
} On the nushell main branch with the above config setting after typing the first command nushell panics as you have noted, but when you point nushell to your code everything works great ! Thank you for fixing this so far.... Now we need to test @fdncred question...
Can you please go ahead and compile nushell with your Reedline just like I did You can just use my branch or just look at what I did and modify your latest nushell code to replicate what I have done... Then we will need to move on to testing the question that @fdncred asks... Thanks for all of your help in making sure nushell works properly with your changes 😄 |
I tested this and am able to confirm that the max_size is ignored ! 😄 I am going to go ahead and land this PR now that this has been confirmed... @andreistan26 we are good ! Thanks for all of your help on this PR... |
This updates the Cargo.lock file for reedline which will enable testing of this Reedline PR nushell/reedline#653
This updates the Cargo.lock file for reedline which will enable testing of this Reedline PR nushell/reedline#653
As of now, setting
capacity
to 0 causes a panic, defaulting to 1 solves this issue with minimum overhead.Fixed issue: nushell/nushell#10826