Hi Olaf, I removed atexit() from scanimage and comitted the patch last night.
Now scanimage doesn't hang anymore under OpenSuse with libusb-compat. Cheers, Rolf Am 20.08.2015 um 01:09 schrieb Olaf Meeuwissen: > Hi Rolf, > > Rolf Bensch writes: > >> Hi Olaf, >> >> Am 19.08.2015 um 03:27 schrieb Olaf Meeuwissen: >>> >>> Rolf Bensch writes: >>> >>>> Using fork or pthread makes no difference. >>>> >>>> A sleep at the end of main() works wonders. >>>> >>>> But not for the other exit() functions. 'scanimage -h' or 'scanimage -A' >>>> still hang with the same issue. >>>> >>>> I suggest to replace atexit and all exit() functions by the existing >>>> scanimage_exit() function. >>>> >>>> Please check if attached patch is running with your installations. >>> >>> I had a look at the patch and tripped over the fixme. Next, I had a >>> look at the scanimage_exit() implementation and the timing of adding >>> that to the list of functions to call atexit. Something definitely >>> smells there. >>> >>> - scanimage_exit() may call sane_close(). That function may need to do >>> device I/O. >>> - scanimage_exit() is register with atexit() *before* sane_init() gets >>> called. This means that any functions registered via atexit() in a >>> backend run *before* scanimage_exit(). >>> - none of the backends call atexit() directly but any library they use >>> may register exit handlers >>> >>> Is there any chance that the libusb-compat installations that are >>> affected register an exit handler? Say something like libusb_exit()? >>> If that is the case, device I/O will be made impossible *before* >>> scanimage_exit() gets a chance to sane_close() the device. >>> >>> Note that the -h and -A options to scanimage need the device's options >>> so that just about guarantees that its backend needs to talk to it. >>> >>> Does moving the atexit() call *after* sane_init() fix this issue? >> >> Good idea, but it doesn't work. Many thanks for your help. > > Too bad. In that case your patch looks fine to me. > > Hope this helps, > -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org