Control: tag -1 patch

On Wed, Jul 03, 2024 at 12:26:59PM +0000, Matthias Klose wrote:
> Package: src:ftpmirror
> Version: 1.96+dfsg-16
> Severity: important
> Tags: sid trixie
> User: debian-...@lists.debian.org
> Usertags: ftbfs-gcc-14

> Usage.xs: In function ‘XS_Fan__Usage_getrusage’:
> Usage.xs:67:37: error: pointer/integer type mismatch in conditional 
> expression [-Wint-conversion]
>    67 |             int log = sv ? SvIV(sv) : NULL;
>       |                                     ^
> Usage.xs:67:23: error: initialization of ‘int’ from ‘void *’ makes integer 
> from pointer without a cast [-Wint-conversion]
>    67 |             int log = sv ? SvIV(sv) : NULL;
>       |                       ^~
> make[3]: *** [Makefile:314: Usage.o] Error 1

Here's a proposed patch for this issue.  It makes the package build for
me.

I haven't tested the resulting binaries in any way, but looking at
the code I suspect this path is never taken unless the user explicitly
undefines $Fan::Usage::LOG. So the risk of a regression seems very low
to me.

Hope this helps,
-- 
Niko Tyni   nt...@debian.org
From: Niko Tyni <nt...@debian.org>
Date: Mon, 5 Aug 2024 08:04:58 +0100
X-Dgit-Generated: 1.96+dfsg-16 9f666f759b9329781768efe594624838e1f5810a
Subject: Fix type confusion with Fan::Usage::LOG

The default is 5 in both DESTROY() below, and on the Perl side in
Usage.pm. So presumably it's fine here as well.

Bug-Debian: https://bugs.debian.org/1074972

---

diff --git a/Fan/Usage/Usage.xs b/Fan/Usage/Usage.xs
index 0d45cc1..9c21876 100644
--- a/Fan/Usage/Usage.xs
+++ b/Fan/Usage/Usage.xs
@@ -64,7 +64,7 @@ getrusage(who = RUSAGE_SELF)
     CODE:
 	{
 	    SV *sv = perl_get_sv("Fan::Usage::LOG", FALSE);
-	    int log = sv ? SvIV(sv) : NULL;
+	    int log = sv ? SvIV(sv) : 5;
 
 	    if (!(RETVAL = malloc(sizeof(Usage))))
 		XSRETURN_UNDEF;

Reply via email to