Bug 2097718

Summary: Please build and ship php bindings to libguestfs
Product: Red Hat Enterprise Linux 9 Reporter: Neal Gompa <ngompa13>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.1CC: brandon.johnson, bstinson, carl, daltonminer, davdunc, davide, davidmccheyne, fedora, jwboyer, lersek, matt, michel, mroche, qzhang, rjones, tzheng, virt-maint, ymao, yoguo
Target Milestone: rcKeywords: 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: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Neal Gompa 2022-06-16 11:42:43 UTC
Description of problem:
The php-libguestfs bindings package was not built in RHEL 9 because it was incompatible with PHP 8. Now that a fix for that has been contributed upstream[1], could you please consider updating libguestfs so that the php bindings package is built and shipped? Ideally, it would be shipped in time to be included in RHEL 9.1.

[1]: https://github.com/libguestfs/libguestfs/commit/ec27979398b0871c1a3e0e244849f8435c9c9a8d

Comment 1 Richard W.M. Jones 2022-06-16 11:47:08 UTC
This is a simple change now that we fixed the bindings upstream.

Comment 3 Richard W.M. Jones 2022-06-17 11:13:15 UTC
As this is a new package, we'd like to ship it in CRB (unsupported).
I don't know if I need to adjust comps to make that happen.

Comment 4 Josh Boyer 2022-06-17 11:20:06 UTC
(In reply to Richard W.M. Jones from comment #3)
> As this is a new package, we'd like to ship it in CRB (unsupported).
> I don't know if I need to adjust comps to make that happen.

Yes.

Comment 6 Neal Gompa 2022-06-17 11:44:30 UTC
It's fairly straightforward to adjust comps, here's an example of how it's done: https://gitlab.com/redhat/centos-stream/release-engineering/comps/-/merge_requests/234

Comment 7 Neal Gompa 2022-06-17 16:27:23 UTC
The build available (https://kojihub.stream.centos.org/koji/buildinfo?buildID=23220) works based on internal testing, but there was something odd: the extension reports its version as 1.0 rather than the actual libguestfs version.

Comment 8 Richard W.M. Jones 2022-06-18 06:43:37 UTC
The PHP extension version is hard-coded as 1.0, see:

https://github.com/libguestfs/libguestfs/blob/60e8ea0312d94860403c956f0f12d491743d3fdd/generator/php.ml#L47
https://github.com/libguestfs/libguestfs/blob/60e8ea0312d94860403c956f0f12d491743d3fdd/generator/php.ml#L261

Since the libguestfs version can only be found at runtime, I don't know
if it would be possible to change this.

FWIW this is how you can print the guestfs library (runtime) version:

<?php

$g = guestfs_create ();
if ($g == false) {
  echo ("Failed to create guestfs_php handle.\n");
  exit;
}
$version = guestfs_version ($g);
printf ("version == %s.%s.%s%s\n", $version["major"],
        $version["minor"], $version["release"],
        $version["extra"]);

?>

Comment 9 Neal Gompa 2022-06-18 15:14:03 UTC
(In reply to Richard W.M. Jones from comment #8)
> The PHP extension version is hard-coded as 1.0, see:
> 
> https://github.com/libguestfs/libguestfs/blob/
> 60e8ea0312d94860403c956f0f12d491743d3fdd/generator/php.ml#L47
> https://github.com/libguestfs/libguestfs/blob/
> 60e8ea0312d94860403c956f0f12d491743d3fdd/generator/php.ml#L261
> 
> Since the libguestfs version can only be found at runtime, I don't know
> if it would be possible to change this.
> 

Well, we know the version at build-time, don't we? So we could at least inject that into there, so we know what version of php-guestfs was built. That's particularly useful for things like composer, which can evaluate php extension dependencies by querying for the extension version.

> FWIW this is how you can print the guestfs library (runtime) version:
> 
> <?php
> 
> $g = guestfs_create ();
> if ($g == false) {
>   echo ("Failed to create guestfs_php handle.\n");
>   exit;
> }
> $version = guestfs_version ($g);
> printf ("version == %s.%s.%s%s\n", $version["major"],
>         $version["minor"], $version["release"],
>         $version["extra"]);
> 
> ?>

Good to know, thanks!

Comment 10 YongkuiGuo 2022-06-20 03:42:40 UTC
The php-libguestfs-1.48.3-3.el9 package has been built: https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=2054404. Will check whether the php-libguestfs package is included in CRB once libguestfs-1.48.3.3 is involved in the rhel9.1 nightly compose repo.

Comment 14 Neal Gompa 2022-06-20 12:52:52 UTC
(In reply to YongkuiGuo from comment #10)
> The php-libguestfs-1.48.3-3.el9 package has been built:
> https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=2054404. Will
> check whether the php-libguestfs package is included in CRB once
> libguestfs-1.48.3.3 is involved in the rhel9.1 nightly compose repo.

It won't be, since comps hasn't been adjusted yet: https://gitlab.com/redhat/centos-stream/release-engineering/comps/-/commits/main

Comment 15 Richard W.M. Jones 2022-06-20 13:17:43 UTC
(In reply to Neal Gompa from comment #9)
> (In reply to Richard W.M. Jones from comment #8)
> > The PHP extension version is hard-coded as 1.0, see:
> > 
> > https://github.com/libguestfs/libguestfs/blob/
> > 60e8ea0312d94860403c956f0f12d491743d3fdd/generator/php.ml#L47
> > https://github.com/libguestfs/libguestfs/blob/
> > 60e8ea0312d94860403c956f0f12d491743d3fdd/generator/php.ml#L261
> > 
> > Since the libguestfs version can only be found at runtime, I don't know
> > if it would be possible to change this.
> 
> Well, we know the version at build-time, don't we? So we could at least
> inject that into there, so we know what version of php-guestfs was built.
> That's particularly useful for things like composer, which can evaluate php
> extension dependencies by querying for the extension version.

Oddly no, we don't have the version at build time.  The generator
is deliberately written not to insert version strings (or anything
that changes often) into the generated bindings.

CRB request is here:
https://gitlab.com/redhat/centos-stream/release-engineering/comps/-/merge_requests/254

Comment 16 YongkuiGuo 2022-06-23 05:27:17 UTC
php-libguestfs-1.48.3-3.el9.x86_64.rpm package has been included in the latest rhel9.1 nightly compose: https://download.eng.bos.redhat.com/rhel-9/nightly/RHEL-9/latest-RHEL-9.1.0/compose/CRB/x86_64/os/Packages/

Comment 17 YongkuiGuo 2022-07-01 01:00:14 UTC
Verified this bug per comment 16.

Comment 19 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