Skip to content

fix: honour $LIBRARY_PATH in _unix_os2_ext() library search#483

Draft
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Koan-Bot:koan.atoomic/fix-issue-471
Draft

fix: honour $LIBRARY_PATH in _unix_os2_ext() library search#483
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Koan-Bot:koan.atoomic/fix-issue-471

Conversation

@Koan-Bot
Copy link

@Koan-Bot Koan-Bot commented Mar 19, 2026

Summary

ExtUtils::Liblist::ext() on Unix/OS2 only searched Config{libpth} (set at Perl build time) plus explicit -L flags, ignoring $LIBRARY_PATH and similar environment variables that GCC and other build tools respect. This caused modules like Term::Readline::Gnu to pick up old system libraries instead of a newer version installed to a custom prefix.

Fixes #471

Changes

  • Prepend $LIBRARY_PATH (colon-separated) to @libpath in _unix_os2_ext() so user-configured paths take priority over Config{libpth}. Explicit -L flags in LIBS still rank highest.
  • Add two tests covering single-path and multi-path LIBRARY_PATH entries.
  • Document the LIBRARY_PATH environment variable in Liblist.pm pod under a new ENVIRONMENT section.

Note: Win32 already honoured $ENV{LIBRARY_PATH} when GCC was in use; this change brings the Unix/OS2 code path to the same level.

Test plan

  • perl -Ilib t/Liblist_Kid.t — all 21 tests pass including the two new ones
  • perl -Ilib t/Liblist.t — all 6 tests pass
  • perl -Ilib t/MM_Unix.t — no regressions (118 tests pass)

Generated by Kōan /fix


Quality Report

Changes: 3 files changed, 43 insertions(+)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

ExtUtils::Liblist::ext() on Unix/OS2 only searched Config{libpth}
(set at Perl build time) plus explicit -L flags, ignoring
$LIBRARY_PATH and similar environment variables that GCC and other
build tools respect.  This caused modules like Term::Readline::Gnu
to pick up old system libraries instead of a newer version installed
to a custom prefix.

* Prepend $LIBRARY_PATH (colon-separated) to @libpath in
  _unix_os2_ext() so user-configured paths take priority over
  Config{libpth}.  Explicit -L flags in LIBS still rank highest.
* Add two tests covering single-path and multi-path LIBRARY_PATH.
* Document the LIBRARY_PATH environment variable in Liblist.pm pod.

Win32 already handled $ENV{LIBRARY_PATH} when gcc was in use; this
change brings the Unix/OS2 code path to the same level.

Fixes Perl-Toolchain-Gang#471

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Set paths searched by ExtUtils::Liblist::ext()

1 participant