Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/perl/, dev-lang/perl/files/
Date: Thu, 28 Oct 2021 03:54:02
Message-Id: 1635393158.d14561cb100beb18ac4df11726c116af4b0070b6.sam@gentoo
1 commit: d14561cb100beb18ac4df11726c116af4b0070b6
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 28 03:52:38 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 28 03:52:38 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d14561cb
7
8 dev-lang/perl: apply patch (prefix-only) for bootstrapping
9
10 Perl may not be able to find 'pwd' during bootstrap because
11 coreutils may not be installed in the new Prefix yet.
12
13 This is an upstream patch to allow falling back
14 to the internal getcwd() to avoid build failure.
15
16 Bug: https://github.com/Perl/perl5/issues/18703
17 Closes: https://bugs.gentoo.org/818172
18 See: https://github.com/Perl/perl5/pull/18791
19 Signed-off-by: Sam James <sam <AT> gentoo.org>
20
21 .../files/perl-5.34.0-fallback-getcwd-pwd.patch | 263 +++++++++++++++++++++
22 dev-lang/perl/perl-5.34.0-r5.ebuild | 6 +
23 2 files changed, 269 insertions(+)
24
25 diff --git a/dev-lang/perl/files/perl-5.34.0-fallback-getcwd-pwd.patch b/dev-lang/perl/files/perl-5.34.0-fallback-getcwd-pwd.patch
26 new file mode 100644
27 index 00000000000..849a09a39a0
28 --- /dev/null
29 +++ b/dev-lang/perl/files/perl-5.34.0-fallback-getcwd-pwd.patch
30 @@ -0,0 +1,263 @@
31 +https://github.com/Perl/perl5/pull/18791
32 +https://github.com/Perl/perl5/issues/18703
33 +https://bugs.gentoo.org/818172
34 +
35 +From: Tony Cook <tony@××××××××××××.com>
36 +Date: Tue, 4 May 2021 14:55:50 +1000
37 +Subject: [PATCH 1/4] remove code that assuming finding pwd on the path is
38 + reasonable
39 +
40 +We deliberately clear PATH when invoking pwd, so this search is
41 +useless.
42 +---
43 + dist/PathTools/Cwd.pm | 14 --------------
44 + 1 file changed, 14 deletions(-)
45 +
46 +diff --git a/dist/PathTools/Cwd.pm b/dist/PathTools/Cwd.pm
47 +index 6a1d2f17ee57..49c12885b32e 100644
48 +--- a/dist/PathTools/Cwd.pm
49 ++++ b/dist/PathTools/Cwd.pm
50 +@@ -213,20 +213,6 @@ sub _backtick_pwd {
51 + # we take care not to override an existing definition for cwd().
52 +
53 + unless ($METHOD_MAP{$^O}{cwd} or defined &cwd) {
54 +- # The pwd command is not available in some chroot(2)'ed environments
55 +- my $sep = $Config::Config{path_sep} || ':';
56 +- my $os = $^O; # Protect $^O from tainting
57 +-
58 +-
59 +- # Try again to find a pwd, this time searching the whole PATH.
60 +- if (defined $ENV{PATH} and $os ne 'MSWin32') { # no pwd on Windows
61 +- my @candidates = split($sep, $ENV{PATH});
62 +- while (!$found_pwd_cmd and @candidates) {
63 +- my $candidate = shift @candidates;
64 +- $found_pwd_cmd = 1 if -x "$candidate/pwd";
65 +- }
66 +- }
67 +-
68 + if( $found_pwd_cmd )
69 + {
70 + *cwd = \&_backtick_pwd;
71 +
72 +From e5378ea37c6c4910107975d8099c1d552af0c7b3 Mon Sep 17 00:00:00 2001
73 +From: Tony Cook <tony@××××××××××××.com>
74 +Date: Wed, 5 May 2021 10:12:31 +1000
75 +Subject: [PATCH 2/4] don't fallback to simple pwd
76 +
77 +When _backtick_pwd invokes $pwd_cmd it first clears the PATH, and since
78 +the command has no shell metacharacters, it perl won't invoke the
79 +shell, so it will always fail.
80 +
81 +An alternative here might be to use "/bin/sh -c pwd" but there's no
82 +guarantee that pwd is available as a shell builtin.
83 +---
84 + dist/PathTools/Cwd.pm | 6 ------
85 + 1 file changed, 6 deletions(-)
86 +
87 +diff --git a/dist/PathTools/Cwd.pm b/dist/PathTools/Cwd.pm
88 +index 49c12885b32e..fbe683e20b8a 100644
89 +--- a/dist/PathTools/Cwd.pm
90 ++++ b/dist/PathTools/Cwd.pm
91 +@@ -181,12 +181,6 @@ if ($^O =~ /android/) {
92 + }
93 +
94 + my $found_pwd_cmd = defined($pwd_cmd);
95 +-unless ($pwd_cmd) {
96 +- # Isn't this wrong? _backtick_pwd() will fail if someone has
97 +- # pwd in their path but it is not /bin/pwd or /usr/bin/pwd?
98 +- # See [perl #16774]. --jhi
99 +- $pwd_cmd = 'pwd';
100 +-}
101 +
102 + # Lazy-load Carp
103 + sub _carp { require Carp; Carp::carp(@_) }
104 +
105 +From e14ffd3c21efe708a5fb5e25f29d61ccb6ee0a0a Mon Sep 17 00:00:00 2001
106 +From: Tony Cook <tony@××××××××××××.com>
107 +Date: Tue, 4 May 2021 15:04:25 +1000
108 +Subject: [PATCH 3/4] avoid a prototype warning assigning \&getcwd to *cwd
109 +
110 +This would produce a warning if we fallback to using getcwd() where
111 +getcwd() has a prototype.
112 +---
113 + dist/PathTools/Cwd.pm | 3 ++-
114 + 1 file changed, 2 insertions(+), 1 deletion(-)
115 +
116 +diff --git a/dist/PathTools/Cwd.pm b/dist/PathTools/Cwd.pm
117 +index fbe683e20b8a..b6dc0b798e8c 100644
118 +--- a/dist/PathTools/Cwd.pm
119 ++++ b/dist/PathTools/Cwd.pm
120 +@@ -212,7 +212,8 @@ unless ($METHOD_MAP{$^O}{cwd} or defined &cwd) {
121 + *cwd = \&_backtick_pwd;
122 + }
123 + else {
124 +- *cwd = \&getcwd;
125 ++ # getcwd() might have an empty prototype
126 ++ *cwd = sub { getcwd(); };
127 + }
128 + }
129 +
130 +
131 +From e725e6ced4d2bbb6a5866992509c2ac3e995c228 Mon Sep 17 00:00:00 2001
132 +From: Tony Cook <tony@××××××××××××.com>
133 +Date: Wed, 12 May 2021 12:24:59 +1000
134 +Subject: [PATCH 4/4] bump PathTools to 3.81
135 +
136 +---
137 + dist/PathTools/Cwd.pm | 2 +-
138 + dist/PathTools/lib/File/Spec.pm | 2 +-
139 + dist/PathTools/lib/File/Spec/AmigaOS.pm | 2 +-
140 + dist/PathTools/lib/File/Spec/Cygwin.pm | 2 +-
141 + dist/PathTools/lib/File/Spec/Epoc.pm | 2 +-
142 + dist/PathTools/lib/File/Spec/Functions.pm | 2 +-
143 + dist/PathTools/lib/File/Spec/Mac.pm | 2 +-
144 + dist/PathTools/lib/File/Spec/OS2.pm | 2 +-
145 + dist/PathTools/lib/File/Spec/Unix.pm | 2 +-
146 + dist/PathTools/lib/File/Spec/VMS.pm | 2 +-
147 + dist/PathTools/lib/File/Spec/Win32.pm | 2 +-
148 + 11 files changed, 11 insertions(+), 11 deletions(-)
149 +
150 +diff --git a/dist/PathTools/Cwd.pm b/dist/PathTools/Cwd.pm
151 +index b6dc0b798e8c..4a9c786c1c3c 100644
152 +--- a/dist/PathTools/Cwd.pm
153 ++++ b/dist/PathTools/Cwd.pm
154 +@@ -3,7 +3,7 @@ use strict;
155 + use Exporter;
156 +
157 +
158 +-our $VERSION = '3.80';
159 ++our $VERSION = '3.81';
160 + my $xs_version = $VERSION;
161 + $VERSION =~ tr/_//d;
162 +
163 +diff --git a/dist/PathTools/lib/File/Spec.pm b/dist/PathTools/lib/File/Spec.pm
164 +index 30d883b61b3e..fe738acf58bd 100644
165 +--- a/dist/PathTools/lib/File/Spec.pm
166 ++++ b/dist/PathTools/lib/File/Spec.pm
167 +@@ -2,7 +2,7 @@ package File::Spec;
168 +
169 + use strict;
170 +
171 +-our $VERSION = '3.80';
172 ++our $VERSION = '3.81';
173 + $VERSION =~ tr/_//d;
174 +
175 + my %module = (
176 +diff --git a/dist/PathTools/lib/File/Spec/AmigaOS.pm b/dist/PathTools/lib/File/Spec/AmigaOS.pm
177 +index fd9da81cdf5a..1398379ca57c 100644
178 +--- a/dist/PathTools/lib/File/Spec/AmigaOS.pm
179 ++++ b/dist/PathTools/lib/File/Spec/AmigaOS.pm
180 +@@ -3,7 +3,7 @@ package File::Spec::AmigaOS;
181 + use strict;
182 + require File::Spec::Unix;
183 +
184 +-our $VERSION = '3.80';
185 ++our $VERSION = '3.81';
186 + $VERSION =~ tr/_//d;
187 +
188 + our @ISA = qw(File::Spec::Unix);
189 +diff --git a/dist/PathTools/lib/File/Spec/Cygwin.pm b/dist/PathTools/lib/File/Spec/Cygwin.pm
190 +index 953c23361a10..55d551ce0663 100644
191 +--- a/dist/PathTools/lib/File/Spec/Cygwin.pm
192 ++++ b/dist/PathTools/lib/File/Spec/Cygwin.pm
193 +@@ -3,7 +3,7 @@ package File::Spec::Cygwin;
194 + use strict;
195 + require File::Spec::Unix;
196 +
197 +-our $VERSION = '3.80';
198 ++our $VERSION = '3.81';
199 + $VERSION =~ tr/_//d;
200 +
201 + our @ISA = qw(File::Spec::Unix);
202 +diff --git a/dist/PathTools/lib/File/Spec/Epoc.pm b/dist/PathTools/lib/File/Spec/Epoc.pm
203 +index fcb9e894e33c..4cde744231aa 100644
204 +--- a/dist/PathTools/lib/File/Spec/Epoc.pm
205 ++++ b/dist/PathTools/lib/File/Spec/Epoc.pm
206 +@@ -2,7 +2,7 @@ package File::Spec::Epoc;
207 +
208 + use strict;
209 +
210 +-our $VERSION = '3.80';
211 ++our $VERSION = '3.81';
212 + $VERSION =~ tr/_//d;
213 +
214 + require File::Spec::Unix;
215 +diff --git a/dist/PathTools/lib/File/Spec/Functions.pm b/dist/PathTools/lib/File/Spec/Functions.pm
216 +index e14ad2f74538..4b3d7bbde130 100644
217 +--- a/dist/PathTools/lib/File/Spec/Functions.pm
218 ++++ b/dist/PathTools/lib/File/Spec/Functions.pm
219 +@@ -3,7 +3,7 @@ package File::Spec::Functions;
220 + use File::Spec;
221 + use strict;
222 +
223 +-our $VERSION = '3.80';
224 ++our $VERSION = '3.81';
225 + $VERSION =~ tr/_//d;
226 +
227 + require Exporter;
228 +diff --git a/dist/PathTools/lib/File/Spec/Mac.pm b/dist/PathTools/lib/File/Spec/Mac.pm
229 +index 8026edcb1261..51d00a01f6f7 100644
230 +--- a/dist/PathTools/lib/File/Spec/Mac.pm
231 ++++ b/dist/PathTools/lib/File/Spec/Mac.pm
232 +@@ -4,7 +4,7 @@ use strict;
233 + use Cwd ();
234 + require File::Spec::Unix;
235 +
236 +-our $VERSION = '3.80';
237 ++our $VERSION = '3.81';
238 + $VERSION =~ tr/_//d;
239 +
240 + our @ISA = qw(File::Spec::Unix);
241 +diff --git a/dist/PathTools/lib/File/Spec/OS2.pm b/dist/PathTools/lib/File/Spec/OS2.pm
242 +index 3c35ba99b48a..57d67ba01e93 100644
243 +--- a/dist/PathTools/lib/File/Spec/OS2.pm
244 ++++ b/dist/PathTools/lib/File/Spec/OS2.pm
245 +@@ -4,7 +4,7 @@ use strict;
246 + use Cwd ();
247 + require File::Spec::Unix;
248 +
249 +-our $VERSION = '3.80';
250 ++our $VERSION = '3.81';
251 + $VERSION =~ tr/_//d;
252 +
253 + our @ISA = qw(File::Spec::Unix);
254 +diff --git a/dist/PathTools/lib/File/Spec/Unix.pm b/dist/PathTools/lib/File/Spec/Unix.pm
255 +index c06d18f46819..df98f580c3ea 100644
256 +--- a/dist/PathTools/lib/File/Spec/Unix.pm
257 ++++ b/dist/PathTools/lib/File/Spec/Unix.pm
258 +@@ -3,7 +3,7 @@ package File::Spec::Unix;
259 + use strict;
260 + use Cwd ();
261 +
262 +-our $VERSION = '3.80';
263 ++our $VERSION = '3.81';
264 + $VERSION =~ tr/_//d;
265 +
266 + =head1 NAME
267 +diff --git a/dist/PathTools/lib/File/Spec/VMS.pm b/dist/PathTools/lib/File/Spec/VMS.pm
268 +index 9b78c8b4bc6e..bbff3ad7d807 100644
269 +--- a/dist/PathTools/lib/File/Spec/VMS.pm
270 ++++ b/dist/PathTools/lib/File/Spec/VMS.pm
271 +@@ -4,7 +4,7 @@ use strict;
272 + use Cwd ();
273 + require File::Spec::Unix;
274 +
275 +-our $VERSION = '3.80';
276 ++our $VERSION = '3.81';
277 + $VERSION =~ tr/_//d;
278 +
279 + our @ISA = qw(File::Spec::Unix);
280 +diff --git a/dist/PathTools/lib/File/Spec/Win32.pm b/dist/PathTools/lib/File/Spec/Win32.pm
281 +index 153744202338..b38419cdf1a6 100644
282 +--- a/dist/PathTools/lib/File/Spec/Win32.pm
283 ++++ b/dist/PathTools/lib/File/Spec/Win32.pm
284 +@@ -5,7 +5,7 @@ use strict;
285 + use Cwd ();
286 + require File::Spec::Unix;
287 +
288 +-our $VERSION = '3.80';
289 ++our $VERSION = '3.81';
290 + $VERSION =~ tr/_//d;
291 +
292 + our @ISA = qw(File::Spec::Unix);
293 +
294
295 diff --git a/dev-lang/perl/perl-5.34.0-r5.ebuild b/dev-lang/perl/perl-5.34.0-r5.ebuild
296 index ba7a5964e28..e066689b21b 100644
297 --- a/dev-lang/perl/perl-5.34.0-r5.ebuild
298 +++ b/dev-lang/perl/perl-5.34.0-r5.ebuild
299 @@ -393,6 +393,12 @@ src_prepare() {
300 "Fix GDBM_File to compile with version 1.20 and earlier"\
301 "https://bugs.gentoo.org/802945"
302
303 + if use prefix ; then
304 + add_patch "${FILESDIR}/${P}"-fallback-getcwd-pwd.patch "0102-5.34.0-fallback-get-cwd-pwd.patch"\
305 + "Fix installation during Prefix bootstrap (finding 'pwd' from coreutils)"\
306 + "https://bugs.gentoo.org/818172"
307 + fi
308 +
309 if [[ ${CHOST} == *-solaris* ]] ; then
310 # do NOT mess with nsl, on Solaris this is always necessary,
311 # when -lsocket is used e.g. to get h_errno