Control: tag -1 patch

On Mon, Jul 03, 2023 at 06:00:44PM +0200, gregor herrmann wrote:
> Source: libimage-imlib2-perl
> Version: 2.03-1.1
> Severity: grave
> Tags: bookworm trixie sid
> Justification: renders package unusable

> While looking at Niko's and Dom's first rebuilds for perl 5.38, I
> noticed that libimage-imlib2-perl "successfully" builds but creates
> a basically empty package:
> 
> http://perl.debian.net/rebuild-logs/perl-5.38/libimage-imlib2-perl_2.03-1.1/libimage-imlib2-perl_2.03-1.1.buildlog
> 
>      dh_auto_configure -a
>   dh_auto_configure: warning: Compatibility levels before 10 are deprecated 
> (level 8 in use)
>       /usr/bin/perl -I. Build.PL --installdirs vendor
>   You must install the imlib2 library before you can install
>   Image::Imlib2. You can obtain imlib2 from
>   http://sourceforge.net/projects/enlightenment/

[...]

> I've started to work on patch which uses pkg-config instead of
> imlib2-config; good news: The package builds (as in: actually builds
> code :)) in oldstable+stable+testing+sid and the
> perl-5.38-rebuild-repo; but the tests only pass in oldstable,
> starting with stable/bookworm (aka libimlib2-dev >= 1.10) they fail
> with:
 
>   #   Failed test at t/simple.t line 68.
>   #          got: '0'
>   #     expected: '1'

Hi, thanks for looking at this.

FWIW I found some prior art in NetBSD for the pkg-config part:

  
https://github.com/NetBSD/pkgsrc/blob/trunk/graphics/p5-Image-Imlib2/patches/patch-Build.PL

but yours looks good to me as well :)

I think the failing test is a bug in imlib2 1.10.0 and I've just filed #1041406 
about it.

I'm attaching a workaround that might be appropriate at least until imlib2 is 
fixed.
-- 
Niko Tyni   nt...@debian.org
>From c2d646b9fa925ac2a91cb6cfb3fe6dad430c7927 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Tue, 18 Jul 2023 15:16:21 +0100
Subject: [PATCH] Work around an imlib2 bug with alpha channel cloning

As discussed in https://bugs.debian.org/1041406 imlib2 1.10.0 introduced
a bug where imlib_clone_image() no longer copies the alpha flag. This
breaks test 12 of t/simple.t :

  #   Failed test at t/simple.t line 68.
  #          got: '0'
  #     expected: '1'

Work around this on our side by checking for any difference after
cloning and copying the alpha flag if necessary.

Bug-Debian: https://bugs.debian.org/1040223
---
 lib/Image/Imlib2.xs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/Image/Imlib2.xs b/lib/Image/Imlib2.xs
index f48d4ec..cc54d2b 100644
--- a/lib/Image/Imlib2.xs
+++ b/lib/Image/Imlib2.xs
@@ -931,9 +931,20 @@ Imlib2_clone(image)
         CODE:
 	{
 		Imlib_Image cloned;
+		char alpha_orig;
+		char alpha_cloned;
 		
 		imlib_context_set_image(image);
 		cloned = imlib_clone_image();
+
+		/* imlib2 no longer clones the alpha flag since 1.10 */
+		alpha_orig = imlib_image_has_alpha();
+		imlib_context_set_image(cloned);
+		alpha_cloned = imlib_image_has_alpha();
+		if (alpha_orig != alpha_cloned) {
+			imlib_image_set_has_alpha(alpha_orig);
+		}
+		imlib_context_set_image(image);
 		
 		RETVAL = cloned;
 	}
-- 
2.39.1

Reply via email to