Richard W.M. Jones
2010-Jun-08 15:07 UTC
[Libguestfs] [PATCH] file: Fix file command on /dev/VG/LV paths (RHBZ#582484).
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora -------------- next part -------------->From ba39ced8804765705f4c61a92db0fddb8d672c7d Mon Sep 17 00:00:00 2001From: Richard Jones <rjones at redhat.com> Date: Tue, 8 Jun 2010 16:04:01 +0100 Subject: [PATCH] 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. --- daemon/file.c | 7 ++++++- src/generator.ml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) 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<file -zbs path>. Note in +The exact command which runs is C<file -zb path>. Note in particular that the filename is not prepended to the output (the C<-b> option). -- 1.6.6.1
Matthew Booth
2010-Jun-08 16:38 UTC
[Libguestfs] [PATCH] file: Fix file command on /dev/VG/LV paths (RHBZ#582484).
On 08/06/10 16:07, Richard W.M. Jones wrote:>> From ba39ced8804765705f4c61a92db0fddb8d672c7d Mon Sep 17 00:00:00 2001 > From: Richard Jones<rjones at redhat.com> > Date: Tue, 8 Jun 2010 16:04:01 +0100 > Subject: [PATCH] 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. > --- > daemon/file.c | 7 ++++++- > src/generator.ml | 2 +- > 2 files changed, 7 insertions(+), 2 deletions(-)ACK. However, as discussed on IRC this call is now a bit of a mess. Could we please deprecate it in favour of a new one? On a related note, perhaps we should update virt-inspector to use vfs_type instead of file. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team M: +44 (0)7977 267231 GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
Reasonably Related Threads
- [PATCH 0/4] Fix RHBZ#597112 (get-e2uuid command)
- [PATCH 0/2] Use link-local addresses when communicating between appliance and host (RHBZ#588763)
- [PATCH] daemon: write-file: Check range of size parameter (RHBZ#597135).
- [PATCH 0/12] Add support for writing to hive files
- [PATCH REBASED] Remove main loop