From: Richard Jones Date: Tue, 8 Jun 2010 15:04:01 +0000 (+0100) Subject: file: Fix file command on /dev/VG/LV paths (RHBZ#582484). X-Git-Tag: 1.3.20~6 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=ba39ced8804765705f4c61a92db0fddb8d672c7d;p=libguestfs.git file: Fix file command on /dev/VG/LV paths (RHBZ#582484). Previous commit 4df593496e116dfb635731c058b7627e81fc179c broke the "file" command on logical volume paths, since these are symbolic links. We *should* follow these (only). This inadvertantly broke virt-inspector too, which indicates that we need more regression testing in this area. Since carrying whole Fedora images around could make the distribution even larger than now, I'm not sure at the moment how to do this. Thanks to Matt Booth for diagnosing this bug. --- diff --git a/daemon/file.c b/daemon/file.c index a55c606..da899b6 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -581,8 +581,13 @@ do_file (const char *path) } } + /* Which flags to use? For /dev paths, follow links because + * /dev/VG/LV is a symbolic link. + */ + const char *flags = is_dev ? "-zbsL" : "-zb"; + char *out, *err; - int r = command (&out, &err, "file", "-zbs", path, NULL); + int r = command (&out, &err, "file", flags, path, NULL); free (buf); if (r == -1) { diff --git a/src/generator.ml b/src/generator.ml index 37d63f2..0ffd3c7 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -1645,7 +1645,7 @@ the type or contents of the file. This call will also transparently look inside various types of compressed file. -The exact command which runs is C. Note in +The exact command which runs is C. Note in particular that the filename is not prepended to the output (the C<-b> option).