Package: shared-mime-info Version: 1.10-1 Severity: important Hello,
thank you for maintaining shared-mime-info. I am doing installation of an arch debian-based system in an arm chroot from an amd64 system, as describe in here: https://www.enricozini.org/blog/2019/himblick/chroot-into-arm/ In such a setup, I observed that update-mime-database produces an empty database without giving any error: # update-mime-database -V /usr/share/mime Updating MIME database in /usr/share/mime... Wrote 0 strings at 2c - 2c Wrote aliases at 2c - 30 Wrote parents at 30 - 34 Wrote literal globs at 34 - 38 Wrote suffix globs at 38 - 40 Wrote full globs at 40 - 44 Wrote magic at 44 - 50 Wrote namespace list at 50 - 54 Wrote icons list at 54 - 58 Wrote generic icons list at 58 - 5c Wrote types list at 5c - 60 # ls -la /usr/share/mime/mime.cache -rw-r--r-- 1 root root 96 Nov 29 12:50 /usr/share/mime/mime.cache After some debugging, I pinpointed that readdir in scan_source_dir returns an error, which gets silently ignored by update-mime-database. This code: static void scan_source_dir(const char *path) { DIR *dir; struct dirent *ent; char *filename; GPtrArray *files; int i; gboolean have_override = FALSE; dir = opendir(path); if (!dir) { perror("scan_source_dir"); exit(EXIT_FAILURE); } fprintf(stderr, "SSD opendir %s\n", path); files = g_ptr_array_new(); while ((ent = readdir(dir))) { should really use a loop like this to check for readdir's errors (see readdir(3) manpage): while (1) { errno = 0; ent = readdir(dir); if (!ent) { if (errno) { perror("scan_source_dir"); exit(EXIT_FAILURE); } else { break; } } .... In the end, the cause of the issue I'm observing is much more exoteric: https://bugs.launchpad.net/qemu/+bug/1805913 https://lkml.org/lkml/2018/12/27/155 but having update-mime-database correctly reporting the readdir errors instead of silently ignoring them, would probably have helped me in finding it much more easily. Enrico -- System Information: Debian Release: 10.2 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.19.0-6-amd64 (SMP w/4 CPU cores) Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8), LANGUAGE=en_IE:en (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages shared-mime-info depends on: ii libc6 2.28-10 ii libglib2.0-0 2.58.3-2+deb10u2 ii libxml2 2.9.4+dfsg1-7+b3 shared-mime-info recommends no packages. shared-mime-info suggests no packages. -- no debconf information