Source: libapp-stacktrace-perl
Version: 0.09-4
Severity: important
Tags: ftbfs patch
User: debian-p...@lists.debian.org
Usertags: perl-5.38-transition

This package fails to build with Perl 5.38 (currently in experimental.)

  
http://perl.debian.net/rebuild-logs/perl-5.38/libapp-stacktrace-perl_0.09-4/libapp-stacktrace-perl_0.09-4+b2_amd64-2023-07-05T10:35:24Z.build

   #   Failed test at t/unthreaded.t line 55.
   #                   '[Thread debugging using libthread_db enabled]
   # Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
   # 0x00007fa9c059a0d4 in select () from /lib/x86_64-linux-gnu/libc.so.6
   # /tmp/GvLM6dPQSV.gdb:1761: Error in sourced command file:
   # No symbol "Perl_get_context" in current context.
   # [Inferior 1 (process 2683997) detached]
   # '
   #     doesn't match '(?^mx:
   #                 (?:
   #                     ^t/unthreaded\.t:\d+\n
   #                 ){10}
   #             )'
   
   #   Failed test 'exit(0)'
   #   at t/unthreaded.t line 66.
   #          got: '1'
   #     expected: '0'
   # Looks like you failed 2 tests of 5.

This seems to be because Perl_get_context is now hidden because it
is not part of the official API.

A fix/workaround is to use PL_current_context instead. Patch attached.
I'm just copycatting here really but this passes the tests on both 5.36
and 5.38. We're only using threaded Perl in Debian so I haven't tested
with an unthreaded one.
-- 
Niko Tyni   nt...@debian.org
>From c0e12b98fe37ada2361853c595b53aa05cbab94a Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Thu, 27 Jul 2023 07:31:29 +0100
Subject: [PATCH] Perl 5.38 compatibility

Perl_get_context() is no longer a public symbol, so we
need to use PL_current_context instead.
---
 lib/App/Stacktrace.pm                         |  1 +
 lib/App/Stacktrace/perl_backtrace_raw.txt     |  8 ++++++++
 lib/App/Stacktrace/perl_backtrace_symbols.txt | 14 ++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/lib/App/Stacktrace.pm b/lib/App/Stacktrace.pm
index 6958a7c..aa3c3d1 100644
--- a/lib/App/Stacktrace.pm
+++ b/lib/App/Stacktrace.pm
@@ -218,6 +218,7 @@ INVOKE
 
 sub _command_for_version {
     return
+        $] >= 5.038     ? 'perl_backtrace_5_38_x' :
         $] >= 5.014     ? 'perl_backtrace_5_14_x' :
         $] >= 5.012     ? 'perl_backtrace_5_12_x' :
         $] >= 5.010     ? 'perl_backtrace_5_10_x' :
diff --git a/lib/App/Stacktrace/perl_backtrace_raw.txt b/lib/App/Stacktrace/perl_backtrace_raw.txt
index 41cf4e6..b0fe842 100644
--- a/lib/App/Stacktrace/perl_backtrace_raw.txt
+++ b/lib/App/Stacktrace/perl_backtrace_raw.txt
@@ -1572,6 +1572,14 @@ end
 define perl_backtrace_5_14_x
     perl_backtrace_5_12_x
 end
+define perl_backtrace_5_38_x
+    set $interpreter = (long) PL_current_context
+    if $interpreter
+        perl_backtrace_5_12_threads
+    else
+        perl_backtrace_nothreads
+    end
+end
 define perl_backtrace_5_14_x_x86_64
     # 5.14.0-linux-x86_64-linux: 3
     # 5.13.11-linux-x86_64-linux: 3
diff --git a/lib/App/Stacktrace/perl_backtrace_symbols.txt b/lib/App/Stacktrace/perl_backtrace_symbols.txt
index a64261d..efe2a63 100644
--- a/lib/App/Stacktrace/perl_backtrace_symbols.txt
+++ b/lib/App/Stacktrace/perl_backtrace_symbols.txt
@@ -429,3 +429,17 @@ define perl_backtrace_5_14_x
         perl_backtrace_nothreads
     end
 end
+
+define perl_backtrace_5_38_x
+    set $CXt_SUB = 8
+    set $CXt_FORMAT = 9
+    set $CXt_EVAL = 10
+    set $interpreter = (PerlInterpreter*)PL_current_context
+    if $interpreter
+        set $POOL_KEY = "threads::_pool1.83"
+        set $POOL_KEY_LEN = 18
+        perl_backtrace_5_12_threads
+    else
+        perl_backtrace_nothreads
+    end
+end
-- 
2.39.1

Reply via email to