这是indexloc提供的服务,不要输入任何密码
Skip to content

[Bug]: cpan -i in postinst scripts does not install Perl modules in an accessible location #27136

@robertkirkman

Description

@robertkirkman

Problem description

cpan -Ti XML::Parser

However, for some reason, cpan -i in normal shell sessions DOES install Perl modules in an accessible location.

Testing indicates that there is some kind of difference in the behavior of the cpan command between interative shells and postinst scripts.

Result of perl -e 'require XML::Parser' after pkg install intltool:

Can't locate XML/Parser.pm in @INC (you may need to install the XML::Parser module) (@INC entries checked: /data/data/com.termux/files/usr/lib/perl5/site_perl/5.40.3/x86_64-android /data/data/com.termux/files/usr/lib/perl5/site_perl/5.40.3 /data/data/com.termux/files/usr/lib/perl5/5.40.3/x86_64-android /data/data/com.termux/files/usr/lib/perl5/5.40.3) at -e line 1.

Result of perldoc -l XML::Parser after pkg install intltool:

No documentation found for "XML::Parser".

Result of perl -e 'require XML::Parser' after cpan -i XML::Parser in an interactive shell:

Result of perldoc -l XML::Parser after cpan -i XML::Parser in an interactive shell:

/data/data/com.termux/files/usr/lib/perl5/site_perl/5.40.3/aarch64-android/XML/Parser.pm

I tried to fix this in

and after that PR, the previous infinite loop that was occurring (this):

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib]
Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib]
Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib]
Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib]

disappeared, but unfortunately what I tried to do still wasn't sufficient to actually install the perl modules in a way that allows them to be successfully used afterward.

What steps will reproduce the bug?

pkg upgrade
pkg install intltool
perl -e 'require XML::Parser'
perldoc -l XML::Parser

What is the expected behavior?

/data/data/com.termux/files/usr/lib/perl5/site_perl/5.40.3/aarch64-android/XML/Parser.pm

System information

Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__APK_FILE=/data/app/~~V6ZnvtL2KaT1It2i86M9Xw==/com.termux-AnZFMelgltzLjG9LcSfvYQ==/base.apk
TERMUX_APP__APK_RELEASE=F_DROID
TERMUX_APP__APP_VERSION_CODE=1022
TERMUX_APP__APP_VERSION_NAME=0.119.0-beta.3
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__IS_DEBUGGABLE_BUILD=false
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PID=11757
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c237,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__TARGET_SDK=28
TERMUX_VERSION=0.119.0-beta.3
TERMUX__APPS_DIR=/data/user/0/com.termux/termux/apps
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c237,c256,c512,c768
TERMUX__UID=10237
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main stable main
# root-repo (sources.list.d/root.list)
deb https://packages-cf.termux.dev/apt/termux-root root stable
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
# glibc-repo (sources.list.d/glibc.list)
deb https://packages-cf.termux.dev/apt/termux-glibc/ glibc stable
# sources.list.d/termux-adb.list
deb https://nohajc.github.io termux extras
# x11-repo (sources.list.d/x11.list)
deb https://packages-cf.termux.dev/apt/termux-x11 x11 main
Updatable packages:
All packages up to date
termux-tools version:
1.45.0
Android version:
13
Kernel build information:
Linux localhost 4.14.190-lineage-gef0cb31b13 #4 SMP PREEMPT Fri Jun 23 13:11:47 CEST 2023 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-A705FN
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so
Installed termux plugins:
com.termux.widget versionCode:1001
com.termux.api versionCode:1002
com.termux.x11 versionCode:15
com.termux.gui versionCode:7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug reportSomething is not working properlyperlIssue is about Perl related stuff, including cpan

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions