Bug 769680

Summary: temporary directories created during appliance builds are not cleaned up on error
Product: [Community] Virtualization Tools Reporter: Stefan Hajnoczi <stefanha>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: gaowanlong, mbooth, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-23 13:34:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Hajnoczi 2011-12-21 17:43:45 UTC
Description of problem:

A machine that I have access too had 38 temporary directories in /var/tmp/guestfs-XXXXXX, where each temporary directory has a unique name.  The directory contained initrd and root images as well as a symlink to the /boot/vmlinuz-* kernel.

Richard Jones suggested that the temporary directory created in src/appliance.c: build_supermin_appliance() is not cleaned up in all error paths.  Additionally, if febootstrap-supermin-helper exits with an error it might not be cleaned up.

The impact of this bug is that disk space is wasted by temporary directories.

Version-Release number of selected component (if applicable):

libguestfs0 1.12.9-2 Debian package

How reproducible:

I do not know how to reproduce the bug but the temporary directories in /var/tmp had been created over a period of weeks and months.

Actual results:

Temporary appliance directories are left over in /var/tmp/guestfs-XXXXXX.

Expected results:

At most one appliance should be cached on the host system.  Temporary directories should be cleaned up.

Comment 1 Richard W.M. Jones 2011-12-23 10:39:15 UTC
Patches posted:
https://www.redhat.com/archives/libguestfs/2011-December/msg00180.html

If tests complete OK, I will push these upstream.

Comment 2 Richard W.M. Jones 2011-12-23 13:34:14 UTC
Passes all of 'make check' and 'make extra-tests' so I'm
going to push this in 1.15.14.

Comment 3 Wanlong Gao 2011-12-24 03:34:15 UTC
I have tested for many times and the /var/tmp/guestfs.XXXXXX can always been cleaned now, I think guestfs___remove_tmpdir can do the right thing except some
specific conditions.


Good luck!

-Wanlong Gao