Repository navigation
perl: put dist/base/lib on miniperl's bootstrap @INC (parallel-build race) - #1233
Conversation
Getopt::Long 2.57+ (perl5#21629) does `use base qw(Exporter)`, but write_buildcustomize.pl adds dist/base/lib to the toolchain @inc only on MSWin32. Under a parallel make, a non-XS extension's manifypods can load Getopt::Long before base.pm is copied into lib/, failing with "Can't locate base.pm in @inc ... Getopt/Long.pm line 24" (seen on the pkgs#1215 arm64 world rebuild). Insert dist/base/lib after the cpan/ExtUtils-PL2Bat/lib anchor and fail the build if the anchor moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 8000
|
| Layer / File(s) | Summary |
|---|---|
Insert and verify library path packages/perl/build.sh |
The script inserts dist/base/lib after the anchor entry and verifies that the entries are adjacent. |
Estimated code review effort: 2 (Simple) | ~5 minutes
Suggested reviewers: msample
Merge Risk: 
Minimal · up to 7fb28
-
No actionable merge-blocking risk is established; the build-path change is ready for normal CI validation.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
There was a problem hiding this comment.
Checked against upstream v5.44.0: write_buildcustomize.pl adds dist/base/lib only in the MSWin32 block, and Getopt::Long 2.58 does use base qw(Exporter) at line 24, so the race is real on Linux and upstream blead still has it. The sed anchor (cpan/ExtUtils-PL2Bat/lib) occurs once in the toolchain list, and I ran the sed and guard against the real file: the guard passes after the edit and fails on the unpatched file. buildcustomize.pl is not installed, so outputs are unchanged, and CI including the full minimal build is green.
Problem
perl 5.44.0 ships Getopt::Long 2.58, which since 2.57 (Perl/perl5#21629) does
use base qw(Exporter).write_buildcustomize.plbuilds the bootstrap@INCthat miniperl uses during the build, and it only addsdist/base/libinside theif $^O eq 'MSWin32'block (lines 54-59 of the 5.44.0 source). On Linux,base.pmis reachable only oncedist/basehas been built and copied intolib/.Under the parallel
make -j$(nproc), a non-XS extension'smanifypodsstep (cpan/podlators) can run before that happens:This failed the arm64 perl build in the pkgs#1215 world rebuild on 2026-10-31.
Fix
Right after
cd perl-5.44.0,packages/perl/build.shnow insertsdist/base/libafter thecpan/ExtUtils-PL2Bat/libline, the last entry of the all-platform toolchain list (line 49 of v5.44.0). It then checks that the line directly after the anchor is the inserted one, so the build fails loudly if a future perl moves the anchor.I didn't use a bare
grep -q '^ dist/base/lib$'as the guard. The MSWin32 entry (line 58) has exactly the same 4-space indentation, so that grep passes on an unpatched file and would not catch a sed that did nothing. I checked the guard against the real v5.44.0 file: it passes after the substitution (emulated with perl, since this Mac has no GNU sed) and fails on the unpatched file.build.shruns underset -e, and the guard is a pipeline whose last command is the decidinggrep -qx, so pipefail isn't needed.Reproducibility is unaffected.
lib/buildcustomize.plis a build-time file, andinstallperlskips it (return if $name =~ /\bbuildcustomize\.pl$/), so the installed tree doesn't change. Adding one more search path for miniperl doesn't change any compiler or linker flags.Review notes
@INCreasoning above.minimal build). Nothing was built locally.🤖 Generated with Claude Code
Summary by CodeRabbit