Bug 806176

Summary: libguestfs doesn't use the external tools (wrestool ...) to get icon even these tools are installed
Product: Red Hat Enterprise Linux 6 Reporter: Yuyu Zhou <yuzhou>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.3CC: leiwang, moli, qguan, qwan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-10 13:00:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 840699    

Description Yuyu Zhou 2012-03-23 05:57:34 UTC
Description of problem:
Fail to inspect-get-icon for windows guests

Version-Release number of selected component (if applicable):
libguestfs-1.16.10-1.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. download a pre-installed Windows guest image
2. Inspect the icon of Windows guests as following:
# guestfish
$ trace 1
$ add Win7-32-hvm..raw
$ run
$ inspect-os
/dev/vda1
$ mount /dev/vda1 /
$ inspect-get-icon /dev/vda1
libguestfs: trace: inspect_get_icon "/dev/vda1"
libguestfs: trace: case_sensitive_path "/etc/favicon.png"
libguestfs: trace: case_sensitive_path = NULL (error)
libguestfs: trace: exists "/etc/favicon.png"
libguestfs: trace: exists = 0
libguestfs: trace: inspect_get_icon = ""

Actual results:
At step2
$ inspect-get-icon /dev/vda1
A zero-length buffer is returned.

Expected results:
At Step2
$ inspect-get-icon /dev/vda1
A buffer containing a PNG image should be returned.

Additional info:
1. In fact, on previous version: libguestfs-1.16.8-1.el6.x86_64
We can get icon from Windows XP 32 bit guest, and Win7 32 bit guest.

In the new vesrion, none of them work.
It seems libguestfs doesn't try the external tools on host to get the os icon even they are installed.
It has:
#if defined(WRESTOOL) && defined(BMPTOPNM) && defined(PNMTOPNG) && \
    defined(PAMCUT)
#define CAN_DO_WINDOWS 1
#endif
but these values (WRESTOOL, BMPTOPNM, PNMTOPNG, PAMCUT) are defined while it's building, so if the build system did have these external tools installed, then the rpm which was built on that host will disable this feature

2. For Win7 64bit guest, it fail even on libguestfs-1.16.8-1.el6.x86_64 as following:
><fs> inspect-get-icon /dev/vda1
libguestfs: trace: list_devices
libguestfs: trace: list_devices = ["/dev/vda"]
libguestfs: trace: list_partitions
libguestfs: trace: list_partitions = ["/dev/vda1"]
libguestfs: trace: lvs
libguestfs: trace: lvs = []
libguestfs: trace: list_dm_devices
libguestfs: trace: list_dm_devices = []
libguestfs: trace: list_md_devices
libguestfs: trace: list_md_devices = []
libguestfs: trace: readdir "/dev"
libguestfs: trace: readdir = NULL (error)
libguestfs: trace: inspect_get_icon "/dev/vda1"
libguestfs: trace: case_sensitive_path "/etc/favicon.png"
libguestfs: trace: case_sensitive_path = NULL (error)
libguestfs: trace: exists "/etc/favicon.png"
libguestfs: trace: exists = 0
libguestfs: trace: case_sensitive_path "/Windows/explorer.exe"
libguestfs: trace: case_sensitive_path = "/Windows/explorer.exe"
libguestfs: trace: filesize "/Windows/explorer.exe"
libguestfs: trace: filesize = 2868224
libguestfs: trace: download "/Windows/explorer.exe" "/dev/fd/3"
libguestfs: trace: download = 0
wrestool: /tmp/libguestfsAb9Zoi/0-explorer: file contains no resources
bmptopnm: Standard Input: read error
pamcut: Error reading magic number from Netpbm image stream.  Most often, this means your input file is empty.
pnmtopng: Error reading magic number from Netpbm image stream.  Most often, this means your input file is empty.
libguestfs: trace: inspect_get_icon = ""

Comment 2 Richard W.M. Jones 2012-03-23 09:26:10 UTC
Removing the 'Regression' keyword:

This isn't a regression because the feature was only added
in libguestfs 1.12, and the previous version of RHEL had
libguestfs 1.8.

---

icoutils isn't in RHEL 6, so to add this feature we would
have to add this package to RHEL, which is uncertain and
probably unlikely.

Comment 4 Richard W.M. Jones 2012-08-10 13:00:33 UTC
Closing because:

(a) We're not likely to add icoutils to RHEL 6.

(b) libguestfs shouldn't use external (ie. unsupported) packages
to parse icons etc.