Bug 801117

Summary: libguestfs cannot get icon for Windows 8
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: mbooth, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-01 11:11:38 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:

Description Richard W.M. Jones 2012-03-07 17:34:39 UTC
Description of problem:

libguestfs inspection currently has a hard-coded test for
Windows 7:

  /* Windows 7. */
  else if (fs->major_version == 6 && fs->minor_version == 1)
    fn = icon_windows_7;

As a result, no icon is returned for Windows 8 (major=6,minor=2).

I tried modifying the test, but the Windows 7 icon code doesn't
work for Windows 8.  The error is:

wrestool: /home/rjones/d/libguestfs/libguestfskHTDWe/1-explorer: file contains no resources
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.

It looks like we need a new icon function to handle Windows 8.

Version-Release number of selected component (if applicable):

1.17.11.

How reproducible:

100%

Steps to Reproduce:
1. Install Windows 8 preview as a guest.
2. Try to display the icon, eg. using the 'display_icon' example program.
3.
  
Actual results:

Fails to display an icon for Windows 8.

Expected results:

It should be able to display an icon for Windows 8.

Additional info:

Comment 1 Richard W.M. Jones 2012-11-30 22:07:57 UTC
Not unsurprisingly, libguestfs 1.19.65 also cannot get
an icon for Windows 8 (full release).

$ ./run ./inspector/virt-inspector /tmp/win8x32.img
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/sda2</root>
    <name>windows</name>
    <arch>i386</arch>
    <distro>windows</distro>
    <product_name>Windows 8 Enterprise</product_name>
    <product_variant>Client</product_variant>
    <major_version>6</major_version>
    <minor_version>2</minor_version>
    <windows_systemroot>/Windows</windows_systemroot>
    <windows_current_control_set>ControlSet001</windows_current_control_set>
    <hostname>win8x32</hostname>
    <format>installed</format>
    <mountpoints>
      <mountpoint dev="/dev/sda2">/</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/sda2">
        <type>ntfs</type>
        <uuid>4EC00F45C00F32AF</uuid>
      </filesystem>
    </filesystems>
    <drive_mappings>
      <drive_mapping name="C">/dev/sda2</drive_mapping>
    </drive_mappings>
    <applications/>
  </operatingsystem>
</operatingsystems>

Comment 2 Richard W.M. Jones 2012-11-30 23:24:27 UTC
I added this temporary patch:

commit 160977987f8e3922cebcdaaeb36fa69f92dc7587 (HEAD, master)
Author: Richard W.M. Jones <rjones>
Date:   Fri Nov 30 23:00:33 2012 +0000

    inspection: Temporary logo for Windows 8.
    
    See the comment from the code:
    
      NB about Windows 8: No location we've found so far contains a
      suitable icon for Win8.  In particular, explorer.exe definitely
      does *not* contain any Windows logo as a resource (I checked).
      Therefore the "basket icon" that this produces is just a stand-in
      until we have a better idea for solving this problem.

Comment 3 Richard W.M. Jones 2012-12-01 11:11:38 UTC
Final fix is upstream:
https://github.com/libguestfs/libguestfs/commit/3d59ed5458575e417e704db58ede43a4e386014d