[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1001178: RFP: liblib-relative-perl -- In Perl scripts, Add paths relative to the current file to @INC



Package: wnpp
Severity: wishlist
X-Debbugs-CC: debian-perl@lists.debian.org

* Package name    : liblib-relative-perl
  Version         : 1.000
  Upstream Author : Dan Book <dbook@cpan.org>
* URL             : https://metacpan.org/pod/lib::relative
* License         : Artistic-2.0
  Programming Lang: Perl
  Description     : In Perl scripts, Add paths relative to the current
file to @INC

Adding a path to @INC to load modules from a local directory may seem
simple, but has a few common pitfalls to be aware of:

Directly adding a relative path to @INC means that any later code that
changes the current working directory will change where modules are
loaded from. This applies to the . path that used to be in @INC by
default until perl 5.26.0, or a relative path added in code like use
lib 'path/to/lib', and may be a vulnerability if such a location is
not supposed to be writable. Additionally, the commonly used FindBin
module relies on interpreter state and the path to the original script
invoked by the perl interpreter, sometimes requiring workarounds in
uncommon cases like generated or embedded code.

This module proposes a more straightforward method: take a path
relative to the current file, absolutize it, and add it to @INC.

The more straightforward name librelative-perl was already taken. [1]
Perhaps the name proposed here is better for consistency, even though
it looks awkward.

Lintian presently uses a series of tedious work-arounds to get the
same functionality.
[2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17]
Thanks!

Kind regards,
Felix Lechner

[1] https://tracker.debian.org/pkg/librelative-perl
[2] https://salsa.debian.org/lintian/lintian/-/blob/master/bin/lintian#L30-38
[3] https://salsa.debian.org/lintian/lintian/-/blob/master/bin/lintian-annotate-hints#L30-38
[4] https://salsa.debian.org/lintian/lintian/-/blob/master/bin/lintian-explain-tags#L30-38
[5] https://salsa.debian.org/lintian/lintian/-/blob/master/bin/spellintian#L28-37
[6] https://salsa.debian.org/lintian/lintian/-/blob/master/private/generate-tag-summary#L9-18
[7] https://salsa.debian.org/lintian/lintian/-/blob/master/private/hintadjust#L31-40
[8] https://salsa.debian.org/lintian/lintian/-/blob/master/private/hintdiff#L31-40
[9] https://salsa.debian.org/lintian/lintian/-/blob/master/private/hintextract#L31-39
[10] https://salsa.debian.org/lintian/lintian/-/blob/master/private/hintsort#L31-40
[11] https://salsa.debian.org/lintian/lintian/-/blob/master/private/latest-policy-version#L31-40
[12] https://salsa.debian.org/lintian/lintian/-/blob/master/private/refresh-data#L27-35
[13] https://salsa.debian.org/lintian/lintian/-/blob/master/private/refresh-locale-codes#L26-35
[14] https://salsa.debian.org/lintian/lintian/-/blob/master/private/refresh-manual-refs#L32-41
[15] https://salsa.debian.org/lintian/lintian/-/blob/master/private/runtests#L36-44
[16] https://salsa.debian.org/lintian/lintian/-/blob/master/private/tag-stats#L17-26
[17] https://salsa.debian.org/lintian/lintian/-/blob/master/private/generate-profiles#L10-18


Reply to: