8000 perl: put dist/base/lib on miniperl's bootstrap @INC (parallel-build race) by bryan-minimal · Pull Request #1233 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content

perl: put dist/base/lib on miniperl's bootstrap @INC (parallel-build race) - #1233

Merged
bryan-minimal merged 1 commit into
mainfrom
perl-buildcustomize-base-race
Nov 2, 2026
Merged

bryan-minimal merged 1 commit into
mainfrom
perl-buildcustomize-base-race

Conversation

@bryan-minimal
@bryan-minimal bryan-minimal commented Nov 1, 2026 •
Copy link
Copy Markdown
Member

Problem

perl 5.44.0 ships Getopt::Long 2.58, which since 2.57 (Perl/perl5#21629) does use base qw(Exporter). write_buildcustomize.pl builds the bootstrap @INC that miniperl uses during the build, and it only adds dist/base/lib inside the if $^O eq 'MSWin32' block (lines 54-59 of the 5.44.0 source). On Linux, base.pm is reachable only once dist/base has been built and copied into lib/.

Under the parallel make -j$(nproc), a non-XS extension's manifypods step (cpan/podlators) can run before that happens:

Can't locate base.pm in @INC ... at .../Getopt/Long.pm line 24.

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.sh now inserts dist/base/lib after the cpan/ExtUtils-PL2Bat/lib line, 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.sh runs under set -e, and the guard is a pipeline whose last command is the deciding grep -qx, so pipefail isn't needed.

Reproducibility is unaffected. lib/buildcustomize.pl is a build-time file, and installperl skips 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

  • The race is upstream and nondeterministic. A green build here shows that the change parses and builds, not that it fixes the race. The argument for the fix is the @INC reasoning above.
  • perl sits in the world-rebuild closure (tzdata/glibc), so this should merge before pkgs#1215 so that rebuild picks it up.
  • Verification is this PR's CI (minimal-check + the build-bot minimal build). Nothing was built locally.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Build
    • Added a check that stops the Perl build if the expected library path entry is missing or not in the required position.

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>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 1, 2026 00:27
@coderabbitai
coderabbitai Bot commented Nov 1, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 8000

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 79bc882 and 7fb2872.

Files selected for processing: 1
  • packages/perl/build.sh

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Walkthrough

The Perl build script now inserts dist/base/lib after the cpan/ExtUtils-PL2Bat/lib entry in write_buildcustomize.pl. It checks that the entries are adjacent. Under set -e, a failed edit or check stops the script.

Changes: Perl build path

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: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: adding dist/base/lib to miniperl's bootstrap @INC to address a parallel-build race. It is specific and concise.
Docstring Coverage Passed 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. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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

@mitodrummer mitodrummer left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 2, 2026
@bryan-minimal
bryan-minimal removed this pull request from the merge queue due to a manual request Nov 2, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 4b3283f Nov 2, 2026
13 checks passed
@bryan-minimal
bryan-minimal deleted the perl-buildcustomize-base-race branch November 2, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0