jfgailleur / fabricate

Automatically exported from code.google.com/p/fabricate
0 stars 0 forks source link

Does not clean up temp files #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. ls ${TMPDIR:-/tmp} | wc -l
2. Run a build script (like the example provided)
3. ls ${TMPDIR:-/tmp} | wc -l

What is the expected output? What do you see instead?

The expected result is that the number of temporary files is similar before
and after doing the build. Instead, many new temp files are created. I
found around ten thousand files (strace output) produced by fabricate in my
/tmp directory.

What version of the product are you using? On what operating system?

fabricate version 1.13 on Ubuntu Linux 9.10 (karmic) with Python 2.6.4
(r264:75706, Dec  7 2009, 18:45:15).

Please provide any additional information below.

Here's a basic sample script I used for testing. It produces 100 new
temporary files when it is run.

#!/usr/bin/env python

from fabricate import run

for i in range(100):
    run(['dd', 'if=/dev/zero', 'count=1', 'of=foo%d' % i])

Original issue reported on code.google.com by kevingoo...@gmail.com on 9 May 2010 at 8:59

GoogleCodeExporter commented 9 years ago
Actually, this is a bit worse than not cleaning up temp files. It actually 
reverses
the intent of StraceRunner.keep_temps, so it deletes files you want to keep and 
keeps
files you want to delete. E.g., change my example script to include this:

from fabricate import run, StraceRunner
StraceRunner.keep_temps = True

And suddenly the temp files get cleaned up.

It looks like the related --keep option is similarly broken. It uses the
"store_false" action, which seems to reverse the intent. Also, because it 
doesn't
have a default value, it looks like it will always be False (in a boolean 
context),
and it can never influence the value of StraceRunner.keep_temps.

Here's a patch that may fix it. I haven't tested it thoroughly.

Original comment by kevingoo...@gmail.com on 9 May 2010 at 9:34

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, Kevin! I've fixed this now by applying your patch. We had scores of 
unexpected 
temp files lying around, and had obviously never used the --keep-temps option. 
Good 
find. :-)

Original comment by benh...@gmail.com on 10 May 2010 at 8:53

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 3fcdeebba14d.

Original comment by simon.al...@gmail.com on 15 Apr 2013 at 4:38