Description of Problem: At least with microtek2 driver 'scanimage' in a batch mode and using a document feeder has a nasty habit of killing all processes it can reach. Effects are much more spectacular when doing a test from a root account. :-) The problem is that 'cancel_scan()' is using a read with transfer length of 0 after it detected "out of pages to scan" condition (a generic I/O error is used for that - sigh!). Subsequently it is doing a cleanup job with 'close(ms->fd[1]);' followed by 'kill(ms->pid, SIGTERM);'. The problem is that in such case both ms->fd[1] and ms->pid were already set earlier to (-1). While this is not that bad with 'close' (still likely an undefined behaviour) this is an "ouch time" with 'kill'; things work like they are written but hard to believe that in an intended way. I could test that only for microtek2 driver but 'kill' is used quite widely in other backends as well. An attached minimal patch fixes the problem at least for microtek2. Michal michal Version-Release number of selected component (if applicable): How Reproducible: Steps to Reproduce: 1. 2. 3. Actual Results: Expected Results: Additional Information:
Created attachment 38066 [details] a patch to make possible batch scanning with microtek2 driver
Already applied in sane-backends-1.0.6-2, currently in rawhide.
> Already applied in sane-backends-1.0.6-2, currently in rawhide. That is nice but sane-backends-1.0.5-4.1, build Thu Dec 20 06:24:10 2001 and released at the beginning of January as an update for 7.2 distro, have the same problem as I just found when scanner I got now for testing kicked me out from an X windows session.
The update contains just security fixes and not extra bug fixes. This bug is fixed in rawhide, and will appear in the next release.