🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #2987

Bug#1151887: libdbd-pg-perl: debci regression with Perl 5.44: Use of "goto" to jump into a construct is no longer permitted

#2987
From: Niko Tyni
Date: Mon, 02 Nov 2026 15:10
231 lines
10271 bytes
--fAinA3z5Tj9WQX0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Control: tag -1 patch

On Sat, Oct 24, 2026 at 11:49:27AM +0300, Niko Tyni wrote:
> Package: libdbd-pg-perl
> Version: 3.21.2-1
> Severity: important
> User: debian-perl@lists.debian.org
> Usertags: perl-5.44-transition
> 
> This package fails its debci checks with Perl 5.44 (currently in experimental.)
> 
>  t/02attribs.t .......... 
>  Use of "goto" to jump into a construct is no longer permitted at t/dbdpg_test_setup.pl line 271.
>  Dubious, test returned 2 (wstat 512, 0x200)
>  No subtests run 
> 
> The package needed a rebuild for Perl 5.44, and the test suite was
> successful at that time.  Presumably this only happens when DBDPG_INITDB
> is set (see debian/tests/pkg-perl/smoke-env).

The problem seems to be jumping into the INITDB label that
is inside the GETHANDLE: {} block.

I think these are functionally equivalent:

	GETHANDLE: {
		INITDB: foo();
		last GETHANDLE unless bar();
	}
	goto INITDB;

vs.

	GETHANDLE_START:
		INITDB: foo();
		goto GETHANDLE_END unless bar();

	GETHANDLE_END:
	goto INITDB;


Proposed patch attached, this seems to work for me.
-- 
Niko

--fAinA3z5Tj9WQX0T
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="0001-Fix-test-setup-on-Perl-5.44-when-DBDPG_INITDB-is-set.patch"

From 5a03140beb1c31d1c5e74a3192db0c365d84a473 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Mon, 2 Nov 2026 14:49:48 +0000
Subject: [PATCH] Fix test setup on Perl 5.44 when DBDPG_INITDB is set

From Perl 5.44 perldelta.pod:

* Deprecated since 5.12, using "goto" to jump into the body of a loop
  or other block construct from outside is no longer permitted. [GH
  #23618 <https://github.com/Perl/perl5/issues/23618>]

Replace the GETHANDLE block and 'last GETHANDLE' statements with plain
labels at start and end that can still be goto'ed.

GETHANDLE_START isn't used for anything, but was left in for documentation
purposes.

Bug-Debian: https://bugs.debian.org/1151887
---
 t/dbdpg_test_setup.pl | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/t/dbdpg_test_setup.pl b/t/dbdpg_test_setup.pl
index 3113065e..e4792e63 100644
--- a/t/dbdpg_test_setup.pl
+++ b/t/dbdpg_test_setup.pl
@@ -267,13 +267,13 @@ version: $version
     }
 
     ## From here on out, we don't return directly, but save it first
-  GETHANDLE: {
+  GETHANDLE_START:
         eval {
             $dbh = DBI->connect($testdsn, $testuser, $ENV{DBI_PASS},
                                 {RaiseError => 1, PrintError => 0, AutoCommit => 1});
         };
 
-        last GETHANDLE if ! $@; ## Made it!
+        goto GETHANDLE_END if ! $@; ## Made it!
         ## If the error was because of the user, try a few others
         if ($@ =~ /postgres/) {
 
@@ -290,7 +290,7 @@ version: $version
                 $dbh = DBI->connect($testdsn, $testuser, $ENV{DBI_PASS},
                                     {RaiseError => 1, PrintError => 0, AutoCommit => 1});
             };
-            last GETHANDLE if ! $@; ## Made it!
+            goto GETHANDLE_END if ! $@; ## Made it!
 
             ## Final user tweak: set to postgres for Beastie
             if ($testuser ne 'postgres') {
@@ -300,7 +300,7 @@ version: $version
                     $dbh = DBI->connect($testdsn, $testuser, $ENV{DBI_PASS},
                                         {RaiseError => 1, PrintError => 0, AutoCommit => 1});
                 };
-                last GETHANDLE if ! $@; ## Made it!
+                goto GETHANDLE_END if ! $@; ## Made it!
             }
         }
 
@@ -334,7 +334,7 @@ version: $version
         my $initcom = build_command('INITDB --version 2>&1', [$initdb]);
         $info = '';
         eval { $info = qx{$initcom}; };
-        last GETHANDLE if $@; ## Fail - initdb bad
+        goto GETHANDLE_END if $@; ## Fail - initdb bad
         $version = 0;
         if (!defined $info or ($info !~ /Postgres|EnterpriseDB/i and $info !~ /run as root/)) {
             if (defined $info) {
@@ -351,7 +351,7 @@ version: $version
                 $msg .= " Final call was: $initdb";
                 $@ = $msg;
             }
-            last GETHANDLE; ## Fail - initdb bad
+            goto GETHANDLE_END; ## Fail - initdb bad
         }
         elsif ($info =~ /([0-9]+)(?:devel|beta|rc|alpha)/) { ## Can be 10devel
             $version = $1;
@@ -377,10 +377,10 @@ version: $version
         my $pgctlcom = build_command('PGCTL --help 2>&1', [$pg_ctl]);
         $info = '';
         eval { $info = qx{$pgctlcom}; };
-        last GETHANDLE if $@; ## Fail - pg_ctl bad
+        goto GETHANDLE_END if $@; ## Fail - pg_ctl bad
         if (!defined $info or ($info !~ /\@(?:[a-z.-]*?postgresql\.org|enterprisedb\.com)/ and $info !~ /run as root/)) {
             $@ = defined $initdb ? "Bad pg_ctl output: $info" : 'Bad pg_ctl output';
-            last GETHANDLE; ## Fail - pg_ctl bad
+            goto GETHANDLE_END; ## Fail - pg_ctl bad
         }
 
         ## initdb and pg_ctl seems to be available, let's use them to fire up a cluster
@@ -390,7 +390,7 @@ version: $version
         my $initdbcom = build_command('INITDB --locale=LOCALE -E utf8 -D DATADIR 2>&1',
                                       [$initdb, $locale, "$testdir/data"]);
         eval { $info = qx{$initdbcom}; };
-        last GETHANDLE if $@; ## Fail - initdb bad
+        goto GETHANDLE_END if $@; ## Fail - initdb bad
 
         ## initdb and pg_ctl cannot be run as root, so let's handle that
         if ($info =~ /run as root/ or $info =~ /unprivilegierte/) {
@@ -441,18 +441,18 @@ version: $version
             }
             if (!$founduser) {
                 $@ = 'Unable to find a user to run initdb as';
-                last GETHANDLE; ## Fail - no user
+                goto GETHANDLE_END; ## Fail - no user
             }
             if (! -e "$testdir/data") {
                 $@ = 'Could not create a test database via initdb';
-                last GETHANDLE; ## Fail - no datadir created
+                goto GETHANDLE_END; ## Fail - no datadir created
             }
             ## At this point, both $su and $testuser are set
         }
 
         if ($info =~ /FATAL/) {
             $@ = "initdb gave a FATAL error: $info";
-            last GETHANDLE; ## Fail - FATAL
+            goto GETHANDLE_END; ## Fail - FATAL
         }
 
         if ($info =~ /but is not empty/) {
@@ -460,7 +460,7 @@ version: $version
         }
         elsif ($info !~ /pg_ctl/) {
             $@ = "initdb did not give a pg_ctl string: $info";
-            last GETHANDLE; ## Fail - bad output
+            goto GETHANDLE_END; ## Fail - bad output
         }
 
         ## Which user do we connect as?
@@ -512,7 +512,7 @@ version: $version
             }
             if ($testport > $TEST_PORT_MAX) {
                 $@ = "No free ports found for testing: tried $TEST_PORT_MIN to $TEST_PORT_MAX\n";
-                last GETHANDLE; ## Fail - no free ports
+                goto GETHANDLE_END; ## Fail - no free ports
             }
         }
         $@ = '';
@@ -541,7 +541,7 @@ version: $version
             if (! open $cfh, '>>', $conf) {
                 $@ = qq{Could not open "$conf": $!};
                 $debug and Test::More::diag qq{Failed to open "$conf"};
-                last GETHANDLE; ## Fail - no conf file
+                goto GETHANDLE_END; ## Fail - no conf file
             }
             $debug and Test::More::diag qq{Writing to "$conf"};
             print {$cfh} "\n\n## DBD::Pg testing parameters\n";
@@ -595,7 +595,7 @@ version: $version
             $su and chdir $olddir;
             if ($err) {
                 $@ = "Could not startup new database ($COM) ($err)";
-                last GETHANDLE; ## Fail - startup failed
+                goto GETHANDLE_END; ## Fail - startup failed
             }
             sleep 1;
         }
@@ -658,10 +658,10 @@ version: $version
                     redo STARTUP;
                 }
             }
-            last GETHANDLE; ## Made it!
+            goto GETHANDLE_END; ## Made it!
         }
 
-    } ## end of GETHANDLE
+    GETHANDLE_END:
 
     ## At this point, we've got a connection, or have failed
     ## Either way, we record for future runs
-- 
2.55.0


--fAinA3z5Tj9WQX0T--
Technical Details
Message-ID: <NV1Pz-9qsw-3@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod
References: <NRFLz-7z9m-15@gated-at.bofh.it> <NRFLz-7z9m-15@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Niko Tyni <ntyni@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1151887: libdbd-pg-perl: debci regression with Perl 5.44: Use of "goto" to jump into a construct is no longer permitted
Date: Mon, 02 Nov 2026 16:10:01 +0100
Message-ID: <NV1Pz-9qsw-3@gated-at.bofh.it>
References: <NRFLz-7z9m-15@gated-at.bofh.it> <NRFLz-7z9m-15@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Mon Nov  2 15:09:10 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: Niko Tyni <ntyni@debian.org>, 1151887@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: pkg-perl-maintainers@lists.alioth.debian.org
X-Debian-Pr-Message: followup 1151887
X-Debian-Pr-Package: libdbd-pg-perl
X-Debian-Pr-Source: libdbd-pg-perl
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="fAinA3z5Tj9WQX0T"
Content-Disposition: inline
X-Debian-User: ntyni
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2000251
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 231
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 2 Nov 2026 17:07:48 +0200
X-Original-Message-ID: <auinRLcZ8kckePAc@app-dd>
X-Original-References: <atxxF_4l1ulynakr@app-dd> <atxxF_4l1ulynakr@app-dd>