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

Better opening of split zim archive. #879

Closed
mgautierfr opened this issue Apr 22, 2024 · 2 comments · Fixed by #880
Closed

Better opening of split zim archive. #879

mgautierfr opened this issue Apr 22, 2024 · 2 comments · Fixed by #880

Comments

@mgautierfr
Copy link
Collaborator

The "api" to open split file is a bit buggy:

  • Libzim try to open given path.
  • If it cannot, try to open given path appending suffix ".aa", ".ab", ....

However,
If directly given path foo.zimaa, it succeed to open the file and so don't instanciate a MultiPart file reader (and so only foo.zimaa is read and reading of the full archive is broken).
If foo.zim and foo.zim[a-z][a-z] is present, you cannot read split file (either you pass .zim path and you open not split file, or you pass foo.zimaa is it is broken).

We should allow to pass *.zimaa as valid path.

On top of that, we may also check that the file we have opened has a size corresponding to what is declared in the archive header. It could be used to detect this use case but also detect when the zim file is currently downloaded and so not complete.

@mgautierfr mgautierfr changed the title Better opening of splitted zim file. Better opening of split zim archive. Apr 22, 2024
@kelson42 kelson42 added this to the 9.3.0 milestone Apr 22, 2024
@MohitMaliFtechiz
Copy link

If foo.zim and foo.zim[a-z][a-z] is present, you cannot read split file (either you pass .zim path and you open not split file, or you pass foo.zimaa is it is broken).

@mgautierfr Yes it is broken, I have tested this scenario. When there is both .zim and .zimaa file in storage and we pass the .zim file to libzim it loads that file normally. When we try to load the .zimaa file it shows the Dirent pointer table outside (or not fully inside) ZIM file. error. According to your point, I deleted the .zim file from my storage and then again I tried to load the .zimaa file it showed the same error as pervious. It seems libzim is instantiating a Single reader instead of a MultiPart file reader for split zim files as well, since libzim shows this error for those zim files that are broken.

@kelson42
Copy link
Contributor

@mgautierfr This seems mandatory to fix kiwix/kiwix-android#3605. We should create mulestone 9.2.1, as we seem to have a regression around chunk mgmt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants