[Libguestfs] [PATCH 2/2 febootstrap] Allow config files from different packages if both files have zero size.

Richard W.M. Jones rjones at redhat.com
Fri Mar 18 15:00:34 UTC 2011


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org
-------------- next part --------------
>From 48ba44a6751f5455a3afb37fb5809abc507696e1 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Fri, 18 Mar 2011 14:54:23 +0000
Subject: [PATCH 2/2] Allow config files from different packages if both files have zero size.

Fairly recurrent bug in Fedora.  It need not cause us to fail,
provided that both config files are empty.
---
 febootstrap.ml |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/febootstrap.ml b/febootstrap.ml
index 3c634c4..dc44d3d 100644
--- a/febootstrap.ml
+++ b/febootstrap.ml
@@ -79,16 +79,24 @@ let () =
     let combine (name1, ft1, pkg1) (name2, ft2, pkg2) =
       (* Rules for combining files. *)
       if ft1.ft_config || ft2.ft_config then (
-        eprintf "febootstrap: error: %s is a config file which is listed in two packages (%s, %s)\n"
-          name1 pkg1 pkg2;
-        exit 1
-      );
-      if (ft1.ft_dir || ft2.ft_dir) && (not (ft1.ft_dir && ft2.ft_dir)) then (
+	(* It's a fairly frequent bug in Fedora for two packages to
+	 * incorrectly list the same config file.  Allow this, provided
+	 * the size of both files is 0.
+	 *)
+	if ft1.ft_size = 0 && ft2.ft_size = 0 then
+	  (name1, ft1, pkg1)
+	else (
+          eprintf "febootstrap: error: %s is a config file which is listed in two packages (%s, %s)\n"
+            name1 pkg1 pkg2;
+          exit 1
+	)
+      )
+      else if (ft1.ft_dir || ft2.ft_dir) && (not (ft1.ft_dir && ft2.ft_dir)) then (
         eprintf "febootstrap: error: %s appears as both directory and ordinary file (%s, %s)\n"
           name1 pkg1 pkg2;
         exit 1
-      );
-      if ft1.ft_ghost then
+      )
+      else if ft1.ft_ghost then
         (name2, ft2, pkg2)
       else
         (name1, ft1, pkg1)
-- 
1.7.2.3



More information about the Libguestfs mailing list