Module path lookup isn't robust enough for NixOS and some "portable" setups (Bug #872)


Added by Thibault P almost 2 years ago. Updated almost 2 years ago.


Status:New Start date:02/15/2023
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-

Description

Hello Alexis,

AMC on NixOS behaves like a "portable" distribution, where the whole package (including libs, docs, and so on) is stored isolated in a single directory (this is how Nix/NixOS works: there is no global state, no globally shared modules, but a "store" of packages and a ton of symlinks and env variables to bring all that together).

This causes an issue: if for some reason, the system on which AMC runs has a /lib directory, AMC will try to load its modules there, and fail. Changing the MODSDIR variable at compilation doesn't help, because it also changes the installation directory's name, but AFAICT the main executable hardcodes the lib name:

51 $mods_dir=catfile($base_dir,'lib');

Idk enough Perl to offer a patch, but a simple fix could be to improve the test at line 44:

44 if(! -d $mods_dir) {

By checking for the full path of, say, AMC-gui.pl, so $MODSDIR/perl/AMC-gui.pl

Thanks!
Best regards,
Thibault


History

Also available in: Atom PDF