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
Lowering number of saved revisions below 1 crashes program #381
Comments
Thanks @morags for reporting this issue. I have confirmed the crash using Manuskript 0.7.0 on GNU/Linux so the issue applies to all OSes. The console output when decreasing "revisions per minute for the last 10 minutes" from 1 to 0 is as follows:
|
I can try my hand at this one. Assign it to me and I'll see what I can come up with this week. |
@RiderExMachina I tried to assign this issue to you. Unfortunately only the issue creator and @olivierkes and myself are listed as choices. I was unable to add your name directly. Please feel free to develop a fix for this issue. |
Fair enough, I'll be unofficially assigned. |
I'm not sure how to apply the commit listed in the previous message. If you know how (without manually making the changes myself) then please let me know. Otherwise a patch file can be created and uploaded into this issue. To create a patch file the command should be something like:
From a quick look at the code the changes should prevent the divide-by-zero crash. Have you tested what happens when typing in text? Also when creating a patch it is good practice to mention the issue number in the git comment. If you use something like Using a short descriptive title also helps with patch review and tracking down regressions. For example a title like |
@gedakc I understand, I just did not want to claim anything in the comment that I didn't know for 100% certainty resolved this issue. I unfortunately cannot create a patch file right now (it would be several hours until I would be able to), but there should be a couple of ways to get the file. Easiest way would be to download the raw That should be something like the this:
|
Thanks @RiderExMachina for the tips on how to get the patch/file. It will likely be tomorrow before I get a chance to look further into this issue. |
Okay, I just tested it on a different computer (on which I confirmed crashes without the fix). The program no longer crashes, but we need to figure out a way to actually have it so that 0 is a viable option. I'll work on that further later but for now will create a PR so we can not have baseless crashing. |
Thanks @RiderExMachina for trying to find a solution to this issue. I tested the code in PR #384, and it does indeed prevent the crash. One problem I see occurs when I reduce a revision setting to "0". The "0" appears in the Settings UI as would be expected. However when I exit the Settings window and reenter Edit -> Settings then the revision reverts to the previous value (1 in my case). This represents inconsistent behaviour. Perhaps a better way is to consider a different approach to preventing the crash. We might consider limiting the range of values for each revision in the GUI. For example we could prevent values below 1. Further we might also limit the upper bound of how many revisions are saved in a given time frame. For example it doesn't make sense in my mind to make a revision save every second. What are your thoughts on preventing the zero value in the UI? |
My thought to preventing issues would be to have an if/else branch for the settings. if the number is set to zero it doesn't divide and should theoretically work as intended (save no drafts for the period of time specified). However, at this current moment I don't know which value does what in the code, so I would need to either reverse-engineer it or ask someone who knows more about that particular spot more about how to proceed. |
That sounds like a reasonable approach too. Unfortunately the person who knows the code base best has not been in contact for a long time. This means that it is up to the person creating the fix to learn the area of the code base in order to create a proper fix. Ideally the proposed fix should be well tested before being posted for review. |
Understood. I'll toy with the code this weekend and see if I can come up with a good fix. Do you think it would be okay to merge the current PR for a temporary solution until then or would you prefer not to? |
My preference is to not merge the current PR because the fix introduces inconsistent behaviour. Also the cause of the crash is not something that writers are encountering every day. My guess is that most writers probably don't play around with the revisions settings. EDIT: Additionally the title of the commit in the PR is vague. "Attempt to avoid crash" is not specific. Avoid which crash? Is it an attempt because the code hasn't been tested? What will later developers think when they see this commit? |
That is fair. And yes, the original commit message of "attempt to avoid crash" was because at the time it hadn't been tested. I understand that the "crash" in question is vague, so that is probably for the best. |
Lowering the number of saved revisions below 1 is now prevented with the merge of PR #655. Hence closing this issue as resolved. |
Under Settings -> Revisions: Lowering any of the counters below "1" causes an immediate crash.
The text was updated successfully, but these errors were encountered: