Bug 974490 - Regression: Fedora inspection broken by change from guestfs_exists to guestfs_is_file
Regression: Fedora inspection broken by change from guestfs_exists to guestfs...
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
Depends On: 974489
  Show dependency treegraph
Reported: 2013-06-14 05:21 EDT by Richard W.M. Jones
Modified: 2014-06-17 21:59 EDT (History)
6 users (show)

See Also:
Fixed In Version: libguestfs-1.22.4-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 974489
Last Closed: 2014-06-13 06:15:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2013-06-14 05:21:33 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:
(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:


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

<?xml version="1.0"?>

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:
Comment 1 Richard W.M. Jones 2013-07-18 12:08:24 EDT
Upstream fix is included in >= 1.22.3.
Comment 3 Lingfei Kong 2013-11-08 04:00:54 EST
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"?>

also I can not find some content like: "<distro>fedora</distro>" from the output.
Comment 4 Lingfei Kong 2013-12-06 03:50:31 EST
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"?>
    <product_name>Fedora release 18 (Spherical Cow)</product_name>

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.
Comment 5 Ludek Smid 2014-06-13 06:15:40 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.