Subject: | Cleaning up /tmp directory; predictable tmp filenames |
Today I observed in my /tmp directory that running tests on
MLAWREN/SQL-DB-0.09.tar.gz left over some files with rather predictable
filenames
-rw-r--r-- 1 sand sand 3072 Oct 15 13:53 sqldb25360.db
-rw-r--r-- 1 sand sand 3072 Oct 15 13:53 sqldb25616.db
-rw-r--r-- 1 sand sand 3072 Oct 15 13:54 sqldb26015.db
-rw-r--r-- 1 sand sand 3072 Oct 15 13:54 sqldb26267.db
-rw-r--r-- 1 sand sand 3072 Oct 15 13:54 sqldb26507.db
-rw-r--r-- 1 sand sand 3072 Oct 15 13:55 sqldb26755.db
-rw-r--r-- 1 sand sand 3072 Oct 15 13:55 sqldb26993.db
May I suggest that you use File::Temp to produce (1) unpredictable files
and (2) cleanup after the work is done on them? Predictable filenames in
/tmp have rather nasty security implications when people run the tests
as root so should be avoided.
Thanks!