file: Fix file command on /dev/VG/LV paths (RHBZ#582484).

Previous commit 4df593496e 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.
This commit is contained in:
Richard Jones
2010-06-08 16:04:01 +01:00
parent 1253f577fa
commit ba39ced880
2 changed files with 7 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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).