RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 974490 - Regression: Fedora inspection broken by change from guestfs_exists to guestfs_is_file
Summary: Regression: Fedora inspection broken by change from guestfs_exists to guestfs...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 974489
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-14 09:21 UTC by Richard W.M. Jones
Modified: 2014-06-18 01:59 UTC (History)
6 users (show)

Fixed In Version: libguestfs-1.22.4-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 974489
Environment:
Last Closed: 2014-06-13 10:15:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2013-06-14 09:21:33 UTC
+++ 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:

Comment 1 Richard W.M. Jones 2013-07-18 16:08:24 UTC
Upstream fix is included in >= 1.22.3.

Comment 3 Lingfei Kong 2013-11-08 09:00:54 UTC
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.

Comment 4 Lingfei Kong 2013-12-06 08:50:31 UTC
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.

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