Bug 2117004

Summary: RFE: Add support for Zstandard compression to guestfs_file_architecture API
Product: Red Hat Enterprise Linux 9 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.1CC: lersek, qzhang, rjones, virt-maint, ymao, yoguo
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.48.4-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:52:35 UTC Type: Feature Request
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: 2116811    

Description Richard W.M. Jones 2022-08-09 17:57:09 UTC
This bug was initially created as a copy of Bug #2116811

Description:

The guestfs_file_architecture API:
https://libguestfs.org/guestfs.3.html#guestfs_file_architecture
can currently unpack binaries in various compressed formats such
as .gz and .xz.  We require this because this API can be used on
Linux kernel modules which are commonly compressed.

Recently (bug 2116811) we have found kernels using zstd
compression for kernel modules (.ko.zst).  To be able to
process these guests in virt-v2v we need libguestfs to add
support for zstd-compression to this API.

Comment 3 Richard W.M. Jones 2022-08-11 11:48:42 UTC
To test this you could try:

  $ cd /var/tmp
  $ cp /usr/bin/ls ls
  $ zstd ls
  ls                   : 47.13%   (   143 KiB =>   67.3 KiB, ls.zst)
  $ ls -l ls.zst 
  -rwxr-xr-x. 1 rjones rjones 68873 Aug 11 12:46 ls.zst

  $ guestfish -N fs -m /dev/sda1 upload ls.zst /ls.zst : file-architecture /ls.zst

Before this change you would see:

  libguestfs: error: file_architecture: unknown architecture: /ls.zst

After this change you would see:

  x86_64

(or whatever your local architecture is).

Comment 4 YongkuiGuo 2022-08-11 12:09:04 UTC
(In reply to Richard W.M. Jones from comment #3)
> To test this you could try:
> 
>   $ cd /var/tmp
>   $ cp /usr/bin/ls ls
>   $ zstd ls
>   ls                   : 47.13%   (   143 KiB =>   67.3 KiB, ls.zst)
>   $ ls -l ls.zst 
>   -rwxr-xr-x. 1 rjones rjones 68873 Aug 11 12:46 ls.zst
> 
>   $ guestfish -N fs -m /dev/sda1 upload ls.zst /ls.zst : file-architecture
> /ls.zst
> 
> Before this change you would see:
> 
>   libguestfs: error: file_architecture: unknown architecture: /ls.zst
> 
> After this change you would see:
> 
>   x86_64
> 
> (or whatever your local architecture is).

Thanks for providing the test steps.

On rhel9.1 host:

$ cd /var/tmp
$ cp /usr/bin/ls ls
$ zstd ls
ls                   : 45.98%   (   139 KiB =>   63.8 KiB, ls.zst)
$ ls -l ls.zst 
-rwxr-xr-x. 1 yoguo yoguo 65372 Aug 11 07:53 ls.zst
$ rpm -q libguestfs
libguestfs-1.48.4-1.el9.x86_64
$ guestfish -N fs -m /dev/sda1 upload ls.zst /ls.zst : file-architecture /ls.zst
libguestfs: error: file_architecture: unknown architecture: /ls.zst

$ yum update libguestfs
$ rpm -q libguestfs
libguestfs-1.48.4-2.el9.x86_64
$ guestfish -N fs -m /dev/sda1 upload ls.zst /ls.zst : file-architecture /ls.zst
x86_64

Comment 8 YongkuiGuo 2022-08-15 01:48:22 UTC
Verified this bug since the test case for this bug has been automated and passed in the latest nightly compose test.

Comment 10 errata-xmlrpc 2022-11-15 09:52:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: libguestfs security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7958