[Libguestfs] [PATCH 2/2] Pass '-z' parameter to 'file' command so it looks inside compressed files.

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


Pass the extra -z parameter to file.

Deprecate zfile.

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 549bba81e739ab10d8013c9ca88ce70b0ddda8e4 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at trick.home.annexia.org>
Date: Tue, 28 Jul 2009 15:29:23 +0100
Subject: [PATCH 2/2] Pass '-z' parameter to 'file' command so it looks inside compressed files.

Also we deprecate the old 'zfile' command.
---
 daemon/file.c    |    2 +-
 src/generator.ml |   10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/daemon/file.c b/daemon/file.c
index 6062c50..aab7e93 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -416,7 +416,7 @@ do_file (char *path)
     return NULL;
   }
 
-  r = command (&out, &err, "file", "-bsL", buf, NULL);
+  r = command (&out, &err, "file", "-zbsL", buf, NULL);
   if (freeit) free (buf);
 
   if (r == -1) {
diff --git a/src/generator.ml b/src/generator.ml
index bf3e637..b787850 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -1449,7 +1449,10 @@ This call uses the standard L<file(1)> command to determine
 the type or contents of the file.  This also works on devices,
 for example to find out whether a partition contains a filesystem.
 
-The exact command which runs is C<file -bsL path>.  Note in
+This call will also transparently look inside various types
+of compressed file.
+
+The exact command which runs is C<file -zbsL path>.  Note in
 particular that the filename is not prepended to the output
 (the C<-b> option).");
 
@@ -2914,7 +2917,7 @@ were rarely if ever used anyway.
 
 See also C<guestfs_sfdisk> and the L<sfdisk(8)> manpage.");
 
-  ("zfile", (RString "description", [String "method"; String "path"]), 140, [],
+  ("zfile", (RString "description", [String "method"; String "path"]), 140, [DeprecatedBy "file"],
    [],
    "determine file type inside a compressed file",
    "\
@@ -2923,7 +2926,8 @@ using C<method>.
 
 C<method> must be one of C<gzip>, C<compress> or C<bzip2>.
 
-See also: C<guestfs_file>");
+Since 1.0.63, use C<guestfs_file> instead which can now
+process compressed files.");
 
   ("getxattrs", (RStructList ("xattrs", "xattr"), [String "path"]), 141, [],
    [],
-- 
1.6.2.5



More information about the Libguestfs mailing list