[sane-devel] PATCH: Make creation of output files of scanimage batch mode atomic

Simon Matter simon.matter at invoca.ch
Wed Jan 14 18:40:23 UTC 2009


Hi,

While optimizing our scanmonitord setup for speed I realized an issue with
scanimage in batch mode.

We perform many postprocessing steps on scanned files with daemons called
from scanmonitord (this version is not in CVS yet because it's our
development version). They maintain different queues so shutting down the
server can be done anytime without loosing anything. Another advantage is
that things can run asynchronously and in parallel, which gives better
overall performance when scanning large amounts of pages with multiple
scanners and performing CPU intensive operations like OCR on them.

But, if I load 50 pages into the ADF, scanmonitord will run scanimage in
batch mode and documents are moved to the first queue directory after the
whole job went through. That's why I decided to change the way scanimage
writes it's output files in batch mode so that when the file appears with
it's name, it has been fully written and can be postprocessed immediately.

Attached patch is against current CVS. It creates a temp file using
(unsecure) mktemp(3) and writes to it, then closes the file by temporarily
redirecting stdout to /dev/null and finally renames it to the final name.

Would be nice if that one could go into CVS.

Regards,
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sane-backends-scanimage-batch-atomic-output-files.patch
Type: text/x-patch
Size: 2101 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20090114/77c31834/attachment.bin 


More information about the sane-devel mailing list