[Libguestfs] [PATCH 0/2] Deprecate zfile

Richard W.M. Jones rjones at redhat.com
Tue Jul 28 14:54:44 UTC 2009


There's one user of zfile (in Lib.pm).  This patch removes that use.

Note that the new 'file' command which looks inside compressed files
will report something like this for an initrd:

"ASCII cpio archive (SVR4 with no CRC) (gzip compressed data, from Unix, last modified: Sun May 24 08:26:07 2009)"

so checking for /cpio/ seems sufficient.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-------------- next part --------------
>From a82bfb88e553c6626c99757779f9b500664409ba Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at trick.home.annexia.org>
Date: Tue, 28 Jul 2009 15:43:14 +0100
Subject: [PATCH] Lib.pm: Use 'file' as replacement for 'zfile'.

---
 perl/lib/Sys/Guestfs/Lib.pm |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 00a9bdb..4020c24 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -1307,10 +1307,10 @@ sub _check_for_initrd
 	    my $version = $1;
 	    my @modules;
 
-	    # Disregard old-style compressed ext2 files, since cpio
-	    # takes ages to (fail to) process these.
-	    if ($g->file ("/boot/$initrd") !~ /gzip compressed/ ||
-		$g->zfile ("gzip", "/boot/$initrd") !~ /ext2 filesystem/) {
+	    # Disregard old-style compressed ext2 files and only
+	    # work with real compressed cpio files, since cpio
+	    # takes ages to (fail to) process anything else.
+	    if ($g->file ("/boot/$initrd") =~ /cpio/) {
 		eval {
 		    @modules = $g->initrd_list ("/boot/$initrd");
 		};
-- 
1.6.2.5



More information about the Libguestfs mailing list