-
Notifications
You must be signed in to change notification settings - Fork 35
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
Option: Book files are updated automatically --> Superfluous "update non-DB files" dialog #45
Comments
Are those malformed tags, Unknown tags are does it do it will regular tags? |
It happens with both as far as I can tell, e.g. it seems any unclosed tag can break parsing. |
How can you tell it updates the file, if you haven't done any changes to it? Is it not just the same as it was? |
Here are my test steps:
Every time parsing fails - due to mismatch of XML tags - CR ends up flushing the file and replacing its contents with whatever it could gleam from the filename, even when I explicitly choose not to update non DB files. I've just tested and can confirm it happens with both Parsed, and Unknown tags. |
UPDATE:
|
What is happening is that the deserialization catches an error so it throws an exception so it just returns a null and then the auto discovered data makes that there was some change to the ComicInfo setting it to Dirty and prompting the message. You also need to have the Setting to Update files to on. What I don't get is that the file isn't updated when you press No. It stays like it was malformed. So the first part about the malformed XML, Maybe there is some kind of option we can pass to it to maybe ignore it. If it is possible I don't know if it is a good idea to allow that. The ComicRackCE/ComicRack.Engine/ComicInfo.cs Lines 1461 to 1471 in 8da6126
But the second part about it being updated even when telling know I can't reproduce, the file is untouched and the code goes over the part about writing to the file. Now if someone would update multiple file and say yes the malformed on would be lost, It might be inevitable. ComicRackCE/ComicRack/MainForm.cs Lines 1079 to 1094 in 8da6126
Maybe you have something that locked the file in the failed state? The fact you mentionned a temp file next to it, might be a cue. |
It seems the setting is checked only here: ComicRackCE/ComicRack.Engine/QueueManager.cs Lines 487 to 507 in e1b9a0e
I'm trying to figure out whether it's better to do amend the 1st or the 2nd check. |
OK, I'm starting to understand the behavior. Book files are updated automatically ON:
Book files are updated automatically OFF:
Having thought about it more, I think it makes more sense to go with Option 2: disable the dialog if the option is ON. I think failed deserialization behavior should still be addressed, but elsewhere. |
Ok I will explain how the app is suppose to work, I don't believe there is any problem here:
Now the reason when you stop the debug it doesn't asks, is that it isn't the same as closing the program normally. It's like force closing it, so it never executes it's closing tasks, like saving the settings, db, etc. So for files in the database:
For files NOT is the database:
The program asks "Save changed information for Books that are not in the database?" What it means is: You made changes to the data but these were not saved in the database and if I don't update these files your changes will be lost. AKA: I got data that might be lost since it wasn't saved anywhere else. As for the So when it asks you at the end, it only does if there are Dirty files, that is the place you should be checking. Why does it report the file as being dirty if it was updated? So if we merge your change in #48 all those that have changes and have the |
TL;DR:
It's actually the opposite:
What's wrong with the
Change #48
On DB vs Non-DB files Yes, I do understand we only ever deal with the ComicInfo.xml and nothing else. The problem is that the behavior hinted by the Dialog is not honored if On
I actually properly closed CR every time, (e.g. I did not use the red square to stop execution) to trigger On delegates
Now this one I have to argue: It can be can be a means of registering a callback and callbacks invocation can be distinct from assignment. However, a lot of the time delegates are invoked synchronously when used as an alternative to a lambda expression: Here's that's exactly what's happening, we supply the definition of an anonymous function that the |
I really don't want to argue and really don't have the time for that. here are the bullet points:
Also I didn't mean that the delegate is like async, what I mean is that it will me called when it's invoked. This is a QueueManager, so it queues updates. It can be done later. If you follow the execution path, it will sleep in a while loop for 1 second until the images pool is done, before invoking the delegate. And since it's a queue it can be done hundreds of files later. I will give you an example I once created a scheduler that updated every day at a specific time, here the delegate (or lambda, they are basically the same) is this.NewDailyScheduler(() => ReloadData(), 15, 05, DailyScheduler.Scheduler.EveryDay); Also I rarely seen 7-zip .tmp file like that, when they do, the disappear almost instantly. If you have it open while CR is open it will lock the file and prevent any changes. Are you certain this isn't related to the dirty flag not being removed? I think the proper test procedure would be:
|
Describe the bug
When the option Book files are updated automatically is enabled, all changes are automatically committed to the files.
Thus the Updates non-DB files Dialog is superfluous as changes are already committed.
Worse, it may mislead the User, giving the impression that the option normally doesn't affect Non-DB files.
This behavior was discovered while investigating XML deserializaiton issues.
If deserializaiton fails, ComicInfo is marked as dirty.
Together with the option above CR will flush the ComicInfo.xml.
Behaviour was triggered by intentionally mangling XML opening/closing tags so they're unpaired to check error handling.
CR will always updates malformed ComicInfo.xml, even if the user chooses not update files outside the DB.Exact Steps to Reproduce
Version/Commit (check the about page, next to the version, for the string between brackets):
The text was updated successfully, but these errors were encountered: