Package: libsane Version: 1.0.25-2 Severity: important Dear Maintainer,
even a trivial program that uses sane_init, sane_get_devices, and sane_exit in a loop, crashes with SIGSEGV in the moment that a change on the device list occurs. I.e. the following program crashes when you switch on or off a scanner after you started it: #include <sane/sane.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main (int argc, char **argv) { while (1) { if (sane_init(0, 0) != SANE_STATUS_GOOD) exit (1); const SANE_Device ** device_list; if (sane_get_devices (&device_list, 1) == SANE_STATUS_GOOD) { const SANE_Device **dev = device_list; while (*dev) dev++; printf ("Device count: %d\n", dev - device_list); } else { fputs ("Failed sane_get_devices\n", stderr); } sleep (1); sane_exit(); sleep (1); } } The result seems to be a heavy memory corruption, at least I could not get any sensible information from a core dump produced. I get the same behaviour with two different backends, epson2 and the epkowa/iscan2 provided by Epson. In practice, this is what occurs to scanbd, only that this is a much more complicated piece of software. I would have expected that this program runs slow and inefficient, but stable, and presents an up-to-date number of switched-on, connected scanners. A finding that might be related or a different bug on its own is, that the list returned by sane_get_devices does never change if you do not call sane_init/sane_exit in the loop. This is at least a difference to the documented behaviour. In summary, it appears impossible to write a program that presents an up-to-date scanner device list without restarting itself..? Yours, Andreas. -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 4.3.0-1-amd64 (SMP w/1 CPU core) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Init: systemd (via /run/systemd/system) Versions of packages libsane depends on: ii acl 2.2.52-2 ii adduser 3.113+nmu3 ii libavahi-client3 0.6.32~rc+dfsg-1 ii libavahi-common3 0.6.32~rc+dfsg-1 ii libc6 2.21-7 ii libexif12 0.6.21-2 ii libgphoto2-6 2.5.9-3 ii libgphoto2-port12 2.5.9-3 ii libieee1284-3 0.2.11-12 ii libjpeg62-turbo 1:1.4.1-2 ii libsane-common 1.0.25-2 ii libtiff5 4.0.6-1 ii libusb-1.0-0 2:1.0.20-1 ii makedev 2.3.1-93 ii udev 228-4+b1 Versions of packages libsane recommends: ii libsane-extras 1.0.22.3 ii sane-utils 1.0.25-2 Versions of packages libsane suggests: ii avahi-daemon 0.6.32~rc+dfsg-1 pn hplip <none> -- no debconf information