-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
622 corrupted zim leads to crash #726
Conversation
int count = std::max((35 - (int)[self.results count]) / (int)titleSearchArchives.size(), 5); | ||
[self addTitleSearchResults:titleSearchArchives count:(int)count]; | ||
} | ||
try { |
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.
You probably don't want to try/catch the whole loop adding the archive but try/catch each adding of an archive.
Else, the first corrupted zim file with stop the loop.
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, make sense. Please see it updated.
int count = std::max((35 - (int)[self.results count]) / (int)titleSearchArchives.size(), 5); | ||
[self addTitleSearchResults:titleSearchArchives count:(int)count]; | ||
} | ||
} catch (std::exception) {} |
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.
Sadly, xapian exception are not inheriting standard exception.
So you should also catch Xapian::Error
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.
Once you have fixed libzim, it wil!?
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.
If we need to use that, it needs to be exported / exposed. Currently we can only access:
namespace Xapian {
class Enquire;
class MSet;
};
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.
This should be handled in openzim/libzim#870
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.
Do you think we could stick to the convention of throwing only std::exception
?
If Xapian::Error
could be caught by the libzim, and re-thrown as std::exception
that would be the simplest / cleanest solution for client apps on Apple.
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.
Yes IMHO
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.
Do you think we could stick to the convention of throwing only std::exception?
If Xapian::Error could be caught by the libzim, and re-thrown as std::exception that would be the simplest / cleanest solution for client apps on Apple.
Yes, that's the plan with openzim/libzim#873, we will throw a zim::zim::ZimFileFormatError
(which inherit std::exception
) or handle the exception internally to returns default value.
When we will do one or the other solution is still open to discussion (and evolution), but it will always be one of the two ways (or a bug in libzim code).
@BPerlakiH Can younplease rebase and fix conflict? |
@kelson42 rebased and conflict solved. |
b3f47fa
to
7ac2e31
Compare
libkiwix 13.1.0-1 has been released |
7ac2e31
to
0a8e0c7
Compare
@BPerlakiH Can you please check if if works now with the latest version of the libzim/libkiwix? |
commit b3f47fa Merge: a90d196 b019f69 Author: Balazs Perlaki-Horvath <[email protected]> Date: Sun Apr 14 17:35:12 2024 +0200 Merge branch '622-corrupted-zim-leads-to-crash' of github.com:kiwix/apple into 622-corrupted-zim-leads-to-crash commit a90d196 Author: Balazs Perlaki-Horvath <[email protected]> Date: Tue Apr 9 21:31:22 2024 +0200 Update try catch commit b784b27 Author: Balazs Perlaki-Horvath <[email protected]> Date: Tue Apr 9 13:19:11 2024 +0200 Wrap search in standard exception handling commit b019f69 Merge: d6e8e9a 8541cde Author: Balazs Perlaki-Horvath <[email protected]> Date: Tue Apr 9 23:54:53 2024 +0200 Merge branch '622-corrupted-zim-leads-to-crash' of github.com:kiwix/apple into 622-corrupted-zim-leads-to-crash commit d6e8e9a Author: Balazs Perlaki-Horvath <[email protected]> Date: Tue Apr 9 21:31:22 2024 +0200 Update try catch commit c132912 Author: Balazs Perlaki-Horvath <[email protected]> Date: Tue Apr 9 13:19:11 2024 +0200 Wrap search in standard exception handling commit 8541cde Author: Balazs Perlaki-Horvath <[email protected]> Date: Tue Apr 9 13:19:11 2024 +0200 Wrap search in standard exception handling commit 57e008e Merge: 5024548 4459187 Author: Balazs Perlaki-Horvath <[email protected]> Date: Tue Apr 9 13:02:15 2024 +0200 Merge branch '622-corrupted-zim-leads-to-crash' of github.com:kiwix/apple into 622-corrupted-zim-leads-to-crash commit 4459187 Author: Balazs Perlaki-Horvath <[email protected]> Date: Mon Apr 8 08:39:00 2024 +0200 Fix unlinked ZIM file tab state
0a8e0c7
to
8c57208
Compare
@kelson42 After updating to latest libzim, and applying one more standard exception handler, the search is working with the corrupted wikipedia ZIM file. |
Preparing for handling standard exception raised as part of #622 .
Fixes #622