-
-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Milestone
Description
The kiwix-manage add command is difficult to debug when failures happen. Multiple different scenarios produce the same error message, so it is unclear what is the problem.
I understand that there are multiple reasons why the add command might fail, ex:
- The Library XML does not exist
- The Library XML is not writable due to incorrect permissions
- The Library XML is not writable due to read-only filesystem
- The ZIM file does not exist
- The ZIM file is not readable due to incorrect permissions
- The ZIM file is corrupt
- (Other reasons I have not considered here)
Steps to reproduce
# Step 1: Create the ZIM file which is not readable to the kiwix user (UID=808)
/data $ ls -l /data/content/ifixit_en_all_2022-06.zim*
-rw------- 1 root root 2717836715 Jun 18 10:24 /data/content/ifixit_en_all_2022-06.zim
-rw------- 1 root root 92 Aug 19 03:19 /data/content/ifixit_en_all_2022-06.zim.sha256
/data $ id
uid=808 gid=808
# Step 2a: Attempt to add the unreadable ZIM
/data $ kiwix-manage /data/library/multi.zim.xml add /data/content/ifixit_en_all_2022-06.zim
Cannot add zim /data/content/ifixit_en_all_2022-06.zim to the library.
# Step 2b: Attempt to add a non-existent ZIM
/data $ kiwix-manage /data/library/multi.zim.xml add /data/content/not_existing.zim
Cannot add zim /data/content/not_existing.zim to the library.
# Step 2c: Attempt to add a corrupt or invalid format ZIM
/data $ dd if=/dev/urandom of=/data/content/corrupt.zim bs=1M count=10
/data $ kiwix-manage /data/library/multi.zim.xml add /data/content/corrupt.zim
Cannot add zim /data/content/corrupt.zim to the library.
# Step 3: Observe that the failures in 2a, 2b, and 2c produce the same error message, but have different causes.
Actual Behavior
The error message "Cannot add zim to the library." appears with no additional detail.
Expected Behavior
The error message "Cannot add zim to the library." appears with additional detail about why the failure happened. If it is not possible to detect the reasons for the failure, perhaps guidance about common issues could be displayed.
Environment
kiwix-serve:latest in Docker/k8s. /data volume is an NFS mount
kiwix-tools 3.3.0
libkiwix 11.0.0
libzim 8.0.0
RyKilleen, houtianze and athyfr