Control: tag -1 patch
Control: forwarded -1 https://github.com/Perl/perl5/pull/20267

On Tue, Aug 30, 2022 at 11:54:25PM +0300, Niko Tyni wrote:
> On Sun, Aug 28, 2022 at 01:41:48PM +0200, Samuel Thibault wrote:
> > Package: perl
> > Version: 5.34.0-5
> > Severity: important
> 
> > perl currently FTBFS on hurd-i386: 
> 
> > #     Error:  Can't load '../../lib/auto/NDBM_File/NDBM_File.so' for module 
> > NDBM_File: ../../lib/auto/NDBM_File/NDBM_File.so: undefined symbol: 
> > dbm_nextkey at ../../lib/XSLoader.pm line 93.
> > #   at ../../lib/NDBM_File.pm line 12.
> 
> I think this broke with
> 
>   https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/pull/367
> 
> but nobody noticed until now.

> Something like this works but seems rather wordy and
> silly to repeat in all of those:
> 
> ------------------------------------------------------
>   my $hint_file = 'hints/linux.pl';
>   open(my $fh, '<', $hint_file)
>       or die "Could not open $hint_file for read: $!";
>   eval join('', <$fh>);
>   die "Failed to load hint file $hint_file: $@" if $@;
> ------------------------------------------------------
> 
> Guess I'll sleep on this and try to come up with something better.

Ended up proposing upstream just

-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;

Patch attached. We'll see how it goes.
-- 
Niko
>From 59cd40b841cc91dd8306ca9abcb3e7f5fafa50bd Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Wed, 31 Aug 2022 21:41:14 +0300
Subject: [PATCH] Fix GNU/{Hurd,kFreeBSD,kNetBSD} hint files in several modules

The idiom of

  do './hints/linux.pl' or die $@;

broke with https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/pull/367
which made $self a lexical variable so it is no longer visible in a file
loaded with 'do'.

This silently makes the loaded Linux hints a no-op, leading to missing
symbols, broken modules and test failures in at least NDBM_File
and ODBM_File on GNU/Hurd, as reported by Samuel Thibault in
https://bugs.debian.org/1018289 .

The replacement of eval `cat hints/linux.pl` is not very sophisticated
but should be enough for this, and alternatives seem overly verbose.

Bug-Debian: https://bugs.debian.org/1018289
---
 dist/Storable/hints/gnukfreebsd.pl  | 2 +-
 dist/Storable/hints/gnuknetbsd.pl   | 2 +-
 ext/DynaLoader/hints/gnukfreebsd.pl | 2 +-
 ext/DynaLoader/hints/gnuknetbsd.pl  | 2 +-
 ext/NDBM_File/hints/gnu.pl          | 2 +-
 ext/NDBM_File/hints/gnukfreebsd.pl  | 2 +-
 ext/NDBM_File/hints/gnuknetbsd.pl   | 2 +-
 ext/ODBM_File/hints/gnu.pl          | 2 +-
 ext/ODBM_File/hints/gnukfreebsd.pl  | 2 +-
 ext/ODBM_File/hints/gnuknetbsd.pl   | 2 +-
 ext/POSIX/hints/gnukfreebsd.pl      | 2 +-
 ext/POSIX/hints/gnuknetbsd.pl       | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/dist/Storable/hints/gnukfreebsd.pl b/dist/Storable/hints/gnukfreebsd.pl
index db6356796..013a2edc4 100644
--- a/dist/Storable/hints/gnukfreebsd.pl
+++ b/dist/Storable/hints/gnukfreebsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/dist/Storable/hints/gnuknetbsd.pl b/dist/Storable/hints/gnuknetbsd.pl
index db6356796..013a2edc4 100644
--- a/dist/Storable/hints/gnuknetbsd.pl
+++ b/dist/Storable/hints/gnuknetbsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/DynaLoader/hints/gnukfreebsd.pl b/ext/DynaLoader/hints/gnukfreebsd.pl
index db6356796..013a2edc4 100644
--- a/ext/DynaLoader/hints/gnukfreebsd.pl
+++ b/ext/DynaLoader/hints/gnukfreebsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/DynaLoader/hints/gnuknetbsd.pl b/ext/DynaLoader/hints/gnuknetbsd.pl
index db6356796..013a2edc4 100644
--- a/ext/DynaLoader/hints/gnuknetbsd.pl
+++ b/ext/DynaLoader/hints/gnuknetbsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/NDBM_File/hints/gnu.pl b/ext/NDBM_File/hints/gnu.pl
index db6356796..013a2edc4 100644
--- a/ext/NDBM_File/hints/gnu.pl
+++ b/ext/NDBM_File/hints/gnu.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/NDBM_File/hints/gnukfreebsd.pl b/ext/NDBM_File/hints/gnukfreebsd.pl
index db6356796..013a2edc4 100644
--- a/ext/NDBM_File/hints/gnukfreebsd.pl
+++ b/ext/NDBM_File/hints/gnukfreebsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/NDBM_File/hints/gnuknetbsd.pl b/ext/NDBM_File/hints/gnuknetbsd.pl
index db6356796..013a2edc4 100644
--- a/ext/NDBM_File/hints/gnuknetbsd.pl
+++ b/ext/NDBM_File/hints/gnuknetbsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/ODBM_File/hints/gnu.pl b/ext/ODBM_File/hints/gnu.pl
index db6356796..013a2edc4 100644
--- a/ext/ODBM_File/hints/gnu.pl
+++ b/ext/ODBM_File/hints/gnu.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/ODBM_File/hints/gnukfreebsd.pl b/ext/ODBM_File/hints/gnukfreebsd.pl
index db6356796..013a2edc4 100644
--- a/ext/ODBM_File/hints/gnukfreebsd.pl
+++ b/ext/ODBM_File/hints/gnukfreebsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/ODBM_File/hints/gnuknetbsd.pl b/ext/ODBM_File/hints/gnuknetbsd.pl
index db6356796..013a2edc4 100644
--- a/ext/ODBM_File/hints/gnuknetbsd.pl
+++ b/ext/ODBM_File/hints/gnuknetbsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/POSIX/hints/gnukfreebsd.pl b/ext/POSIX/hints/gnukfreebsd.pl
index db6356796..013a2edc4 100644
--- a/ext/POSIX/hints/gnukfreebsd.pl
+++ b/ext/POSIX/hints/gnukfreebsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
diff --git a/ext/POSIX/hints/gnuknetbsd.pl b/ext/POSIX/hints/gnuknetbsd.pl
index db6356796..013a2edc4 100644
--- a/ext/POSIX/hints/gnuknetbsd.pl
+++ b/ext/POSIX/hints/gnuknetbsd.pl
@@ -1 +1 @@
-do './hints/linux.pl' or die $@;
+eval `cat hints/linux.pl` or die $@;
-- 
2.30.2

Reply via email to