Red Hat Bugzilla – Bug 974490
Regression: Fedora inspection broken by change from guestfs_exists to guestfs_is_file
Last modified: 2014-06-17 21:59:55 EDT
+++ This bug was initially created as a clone of Bug #974489 +++ [Just need to check that we don't ship RHEL 7.0 by accident with this bug] Description of problem: (Bug found by Matt Booth) The following commit: https://github.com/libguestfs/libguestfs/commit/e71b2c11f59b3f8ae0c4b31c4ab5b0d1bfcdf181 (also present in libguestfs 1.22) changes various calls to guestfs_exists to guestfs_is_file. This was done to make fuzz-testing of inspection easier. Unfortunately at least this change: - if (guestfs_exists (g, "/etc/redhat-release") > 0) { + if (guestfs_is_file (g, "/etc/redhat-release") > 0) { breaks inspection of Fedora guests since /etc/redhat-release is a symlink: $ ls -l /etc/redhat-release lrwxrwxrwx. 1 root root 14 Jan 17 08:28 /etc/redhat-release -> fedora-release I haven't checked all the other distros but it is possible the change could break those as well. What we really want to do is test that these are files or symlinks to files, since if the test succeeds we usually open the file and read its contents. Matt suggests changing the is_file etc APIs to add a followsymlinks optional boolean flag. Possible APIs that would be changed like this are: is-blockdev test if block device is-chardev test if character device is-dir test if a directory is-fifo test if FIFO (named pipe) is-file test if a regular file is-socket test if socket By using the once_had_no_optargs flag in the generator this change should be backwards compatible. Version-Release number of selected component (if applicable): libguestfs 1.22.2 libguestfs >= 1.23.2 How reproducible: 100% Steps to Reproduce: 1. Inspect (eg. run virt-inspector) on a Fedora guest. Actual results: Inspection "half works", but it doesn't detect that it's a Fedora VM: <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>/dev/fedora/root</root> <name>linux</name> <arch>x86_64</arch> <major_version>0</major_version> <minor_version>0</minor_version> Note there is no <distro>fedora</distro> and the major version number are bogus. Expected results: <distro>fedora</distro> and <major_version/> set to some non-zero value. List of applications shown. etc. Additional info:
Upstream fix is included in >= 1.22.3.
I can reproduce it with libguestfs-1.22.2-1.el7 Steps to reproduce: 1. Prepare a Fedora image such as Fedora18, make sure /etc/redhat-release is a symlink: $ ls -l /etc/redhat-release lrwxrwxrwx. 1 root root 14 Jan 17 08:28 /etc/redhat-release -> fedora-release 2. #virt-inspector Fedora-18.raw <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>/dev/fedora_dhcp-11-24/root</root> <name>linux</name> <arch>x86_64</arch> <major_version>0</major_version> <minor_version>0</minor_version> also I can not find some content like: "<distro>fedora</distro>" from the output.
Verified with libguestfs-1.22.6-15.el7 Steps to verify: 1. Prepare a Fedora image such as Fedora18, make sure /etc/redhat-release is a symlink: #ls -l /etc/redhat-release lrwxrwxrwx. 1 root root 14 Apr 24 2013 /etc/redhat-release -> fedora-release 2. #virt-inspector Fedora-18.raw <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>/dev/fedora_dhcp-11-24/root</root> <name>linux</name> <arch>x86_64</arch> <distro>fedora</distro> <product_name>Fedora release 18 (Spherical Cow)</product_name> <major_version>18</major_version> <minor_version>0</minor_version> <package_format>rpm</package_format> <package_management>yum</package_management> I can see <distro>fedora</distro>, <product_name>Fedora release 18 (Spherical Cow)</product_name>, <major_version>18</major_version>, <minor_version>0</minor_version> in the output. So the bug is fixed.
This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request.