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

Bug#779608: xvfb: cleanup on signal exits as well





2016-03-20 15:58 GMT+01:00 Ximin Luo <infinity0@debian.org>:
Jérémy Lal:
>> Hello Ximin,
>>
>> i tried your patch, and now when interrupting using ctrl-c
>> xvfb-run -a myapp
>> i get (i added the "cleaning" message):
>>
>> ^Ccleaning /tmp/xvfb-run.UlOS0T
>> cleaning /tmp/xvfb-run.UlOS0T
>> rm: cannot remove '/tmp/xvfb-run.UlOS0T': No such file or directory
>> xvfb-run: error: problem while cleaning up temporary directory
>>
>> obviously cleanup is run twice.
>>

I couldn't figure out why it is run twice [*], but if you just change "rm -r" to "rm -rf" it will no longer fail. I don't see any problem with that.

I suggest instead to keep a "cleaned" global variable to track if the cleanup function has run once before or not.


Updated patch attached, I also updated the signals (added some more, removed KILL since it doesn't actually work) and added some quoting.

X

[*] Ctrl-C sends SIGINT to the whole process group, so I tried with "kill" specifically to the shell running xvfb but it still double-cleaned. I also tried "trap clean_up <signals>" omitting EXIT and adding "clean_up" before "exit" at the bottom of the script but that didn't fix the double-clean either.

I've had exactly the same problem with a totally unrelated program recently. I suppose that behavior is explained somewhere in the F.M.

Jérémy.


Reply to: