[Libguestfs] [supermin 1/2] chroot: Fix corner case introduced with dpkg-divert support

Richard W.M. Jones rjones at redhat.com
Sat Mar 15 14:38:11 UTC 2014


On Sat, Mar 15, 2014 at 01:59:02PM +0100, Hilko Bengen wrote:
> ---
>  src/chroot.ml | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/chroot.ml b/src/chroot.ml
> index b5c1e53..9e522d9 100644
> --- a/src/chroot.ml
> +++ b/src/chroot.ml
> @@ -26,7 +26,9 @@ let build_chroot debug files outputdir =
>    List.iter (
>      fun file ->
>        try
> -        let path = file.ft_source_path in
> +        let path = if file_exists file.ft_source_path
> +          then file.ft_source_path
> +          else file.ft_path in
>          let st = lstat path in
>          let opath = outputdir // file.ft_path in
>          match st.st_kind with
> @@ -68,7 +70,10 @@ let build_chroot debug files outputdir =
>    (* Second pass: fix up directory permissions in reverse. *)
>    let dirs = filter_map (
>      fun file ->
> -      let st = lstat file.ft_source_path in
> +      let path =
> +        if file_exists file.ft_source_path then file.ft_source_path
> +        else file.ft_path in
> +      let st = lstat path in
>        if st.st_kind = S_DIR then Some (file.ft_path, st) else None
>    ) files in
>    List.iter (
> -- 
> 1.9.0

ACK to both patches (second one with the 'test-harder' fix!)

Thanks, Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list