[Libguestfs] [PATCH] Replace File::Path's remove_tree

Richard W.M. Jones rjones at redhat.com
Wed Jan 26 17:16:31 UTC 2011


On Wed, Jan 26, 2011 at 05:05:42PM +0000, Matthew Booth wrote:
> We were using remove_tree in the RHEV cleanup code. remove_tree seems to use
> chdir. Unfortunately, as this code will be running seteuid(36), it is not
> unlikely that the current working directory will not be readable. This causes
> remove_tree to fail.
> 
> This patch replaces remove_tree with a simple recursive remove, obviously
> without using chdir.

Recursive removes like this are full of potential fail.

I'd prefer it if you did:

  system ('rm', '-rf', $path);

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list