[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#438205: race condition: kdeprint sometimes fails on printing jobs which are removed after kdeprint exits



Package: kdeprint
Version: 3.5.5a.dfsg.1-6

i have a shellscript:

#!/bin/sh
create-pdf a0.pdf
create-pdf a1.pdf
create-pdf a2.pdf
create-pdf a3.pdf
create-pdf a4.pdf
create-pdf a5.pdf
create-pdf a6.pdf
create-pdf a7.pdf
create-pdf a8.pdf
create-pdf a9.pdf
kprinter a0.pdf a1.pdf a2.pdf a3.pdf a4.pdf a5.pdf a6.pdf a7.pdf a8.pdf a9.pdf
rm a0.pdf a1.pdf a2.pdf a3.pdf a4.pdf a5.pdf a6.pdf a7.pdf a8.pdf a9.pdf

the user selects a cups printer in the dialog and prints the files.
normally this works. (did it about 30 times now)

and now suddenly a messagebox appeared:

KNotify:
cupsdoprint failed...
do not find file "a0.pdf"

when i check the existence of a0.pdf i find that it is gone in the moment this 
popup appears.

this means that kprinter exits BEFORE a0.pdf was read.

that is a race condition and IMHO should be fixed, because this kind of script 
is not unusual. every temporary print job is printed like this, for example: 
i am using some c++ program to create pdf stock report files and print them 
by a user configurable program like "lpr" or "kprinter". when that user 
configurable printing program exits, the c++ program immediately removes the 
temporary pdfs from harddisk again of course. i really think this should work 
reliably. otherwise one would have to arrange for a timer which deletes the 
temporary files after 10 seconds - which in itself is again a race 
condition...

cya!
erik

-- 
Erik Thiele



Reply to: