On Sun, May 07, 2017 at 11:24:13PM +0300, Aaro Koskinen wrote: > $ SANE_DEBUG_NET=3 scanimage -L [...] > scanimage: thread-watch.c:171: avahi_threaded_poll_lock: Assertion `p' failed. > Aborted > > It's disabling Avahi support (I don't have such daemon) but still later > calling avahi_threaded_poll_lock() with NULL avahi_thread. [...]
Yes, definitely seems so. Could you please test the attached patch which hopefully takes care of your issue? Regards, Andreas Henriksson
From: Andreas Henriksson <andr...@fatal.se> Subject: Avoid assertion failure when net_avahi_init failed The avahi_threaded_poll_{un,}lock functions does not accept a NULL argument. The avahi_thread variable might be NULL when the net_avahi_init() function failed. We thus need to make sure we don't pass a NULL avahi_thread to any of these functions. Bug-Debian: https://bugs.debian.org/861112 diff -uriNp sane-backends-1.0.26~git20151121/backend/net.c sane-backends-1.0.26~git20151121.nullcheck/backend/net.c --- sane-backends-1.0.26~git20151121/backend/net.c 2015-11-13 03:10:49.000000000 +0100 +++ sane-backends-1.0.26~git20151121.nullcheck/backend/net.c 2017-05-17 22:49:01.922390615 +0200 @@ -1045,12 +1045,12 @@ sane_init (SANE_Int * version_code, SANE continue; } #ifdef WITH_AVAHI - avahi_threaded_poll_lock (avahi_thread); + if (avahi_thread) avahi_threaded_poll_lock (avahi_thread); #endif /* WITH_AVAHI */ DBG (2, "sane_init: trying to add %s\n", device_name); add_device (device_name, 0); #ifdef WITH_AVAHI - avahi_threaded_poll_unlock (avahi_thread); + if (avahi_thread) avahi_threaded_poll_unlock (avahi_thread); #endif /* WITH_AVAHI */ } @@ -1096,12 +1096,12 @@ sane_init (SANE_Int * version_code, SANE continue; #endif /* ENABLE_IPV6 */ #ifdef WITH_AVAHI - avahi_threaded_poll_lock (avahi_thread); + if (avahi_thread) avahi_threaded_poll_lock (avahi_thread); #endif /* WITH_AVAHI */ DBG (2, "sane_init: trying to add %s\n", host); add_device (host, 0); #ifdef WITH_AVAHI - avahi_threaded_poll_unlock (avahi_thread); + if (avahi_thread) avahi_threaded_poll_unlock (avahi_thread); #endif /* WITH_AVAHI */ } free (copy); @@ -1519,11 +1519,11 @@ sane_open (SANE_String_Const full_name, "sane_open: device %s not found, trying to register it anyway\n", nd_name); #ifdef WITH_AVAHI - avahi_threaded_poll_lock (avahi_thread); + if (avahi_thread) avahi_threaded_poll_lock (avahi_thread); #endif /* WITH_AVAHI */ status = add_device (nd_name, &dev); #ifdef WITH_AVAHI - avahi_threaded_poll_unlock (avahi_thread); + if (avahi_thread) avahi_threaded_poll_unlock (avahi_thread); #endif /* WITH_AVAHI */ if (status != SANE_STATUS_GOOD) {