Describe the bug
Executables in perl packages (such as PerconaToolkit) have an interpreter line filled with imports directives which make the interpreter line very long and cause them not to run
To Reproduce
Steps to reproduce the behavior:
pkgs.perl530Packages.PerconaToolkit to your systemPackagespt-online-schema-changeFailed to execute process '/run/current-system/sw/bin/pt-online-schema-change'. Reason:
exec: Exec format error
The file '/run/current-system/sw/bin/pt-online-schema-change' is marked as an executable but could not be run by the operating system.
Expected behavior
I would expect the script to run.
Screenshots
The first line of pt-online-schema-change is:
#!/nix/store/m5ajgnzp2512na31brwfmydwk3l1gawb-coreutils-8.31/bin/env perl -I/nix/store/5mkw2nn6ghpadr95hic5l84vfp5xyana-perl-5.30.2/lib/perl5/site_perl -I/nix/store/0in5y8h75x284jvqkpkvpqmcvwvqqifl-perl5.30.2-DBD-mysql-4.050/lib/perl5/site_perl -I/nix/store/7hxdb03153carm8d1aigc9r7d6kfwrlr-perl5.30.2-DBI-1.642/lib/perl5/site_perl -I/nix/store/s8zc1417pn70cxi07gqakyf5rp4jqhf6-perl5.30.2-IO-Socket-SSL-2.066/lib/perl5/site_perl -I/nix/store/qw07vlklbdxym09ss93kqh18bhhpih29-perl5.30.2-Mozilla-CA-20180117/lib/perl5/site_perl -I/nix/store/kjrqbl98gz51yj2m591cbaasgg85h21l-perl5.30.2-Net-SSLeay-1.88/lib/perl5/site_perl -I/nix/store/ig4z55c21scrh7pfvlhqlwr1f62zlars-perl5.30.2-TermReadKey-2.38/lib/perl5/site_perl -I/nix/store/5mkw2nn6ghpadr95hic5l84vfp5xyana-perl-5.30.2/lib/perl5/site_perl -I/nix/store/0in5y8h75x284jvqkpkvpqmcvwvqqifl-perl5.30.2-DBD-mysql-4.050/lib/perl5/site_perl -I/nix/store/7hxdb03153carm8d1aigc9r7d6kfwrlr-perl5.30.2-DBI-1.642/lib/perl5/site_perl -I/nix/store/s8zc1417pn70cxi07gqakyf5rp4jqhf6-perl5.30.2-IO-Socket-SSL-2.066/lib/perl5/site_perl -I/nix/store/qw07vlklbdxym09ss93kqh18bhhpih29-perl5.30.2-Mozilla-CA-20180117/lib/perl5/site_perl -I/nix/store/kjrqbl98gz51yj2m591cbaasgg85h21l-perl5.30.2-Net-SSLeay-1.88/lib/perl5/site_perl -I/nix/store/ig4z55c21scrh7pfvlhqlwr1f62zlars-perl5.30.2-TermReadKey-2.38/lib/perl5/site_perl -I/nix/store/5mkw2nn6ghpadr95hic5l84vfp5xyana-perl-5.30.2/lib/perl5/site_perl -I/nix/store/0in5y8h75x284jvqkpkvpqmcvwvqqifl-perl5.30.2-DBD-mysql-4.050/lib/perl5/site_perl -I/nix/store/7hxdb03153carm8d1aigc9r7d6kfwrlr-perl5.30.2-DBI-1.642/lib/perl5/site_perl -I/nix/store/s8zc1417pn70cxi07gqakyf5rp4jqhf6-perl5.30.2-IO-Socket-SSL-2.066/lib/perl5/site_perl -I/nix/store/qw07vlklbdxym09ss93kqh18bhhpih29-perl5.30.2-Mozilla-CA-20180117/lib/perl5/site_perl -I/nix/store/kjrqbl98gz51yj2m591cbaasgg85h21l-perl5.30.2-Net-SSLeay-1.88/lib/perl5/site_perl -I/nix/store/ig4z55c21scrh7pfvlhqlwr1f62zlars-perl5.30.2-TermReadKey-2.38/lib/perl5/site_perl -I/nix/store/5mkw2nn6ghpadr95hic5l84vfp5xyana-perl-5.30.2/lib/perl5/site_perl -I/nix/store/0in5y8h75x284jvqkpkvpqmcvwvqqifl-perl5.30.2-DBD-mysql-4.050/lib/perl5/site_perl -I/nix/store/7hxdb03153carm8d1aigc9r7d6kfwrlr-perl5.30.2-DBI-1.642/lib/perl5/site_perl -I/nix/store/s8zc1417pn70cxi07gqakyf5rp4jqhf6-perl5.30.2-IO-Socket-SSL-2.066/lib/perl5/site_perl -I/nix/store/qw07vlklbdxym09ss93kqh18bhhpih29-perl5.30.2-Mozilla-CA-20180117/lib/perl5/site_perl -I/nix/store/kjrqbl98gz51yj2m591cbaasgg85h21l-perl5.30.2-Net-SSLeay-1.88/lib/perl5/site_perl -I/nix/store/ig4z55c21scrh7pfvlhqlwr1f62zlars-perl5.30.2-TermReadKey-2.38/lib/perl5/site_perl -I/nix/store/5mkw2nn6ghpadr95hic5l84vfp5xyana-perl-5.30.2/lib/perl5/site_perl -I/nix/store/0in5y8h75x284jvqkpkvpqmcvwvqqifl-perl5.30.2-DBD-mysql-4.050/lib/perl5/site_perl -I/nix/store/7hxdb03153carm8d1aigc9r7d6kfwrlr-perl5.30.2-DBI-1.642/lib/perl5/site_perl -I/nix/store/s8zc1417pn70cxi07gqakyf5rp4jqhf6-perl5.30.2-IO-Socket-SSL-2.066/lib/perl5/site_perl -I/nix/store/qw07vlklbdxym09ss93kqh18bhhpih29-perl5.30.2-Mozilla-CA-20180117/lib/perl5/site_perl -I/nix/store/kjrqbl98gz51yj2m591cbaasgg85h21l-perl5.30.2-Net-SSLeay-1.88/lib/perl5/site_perl -I/nix/store/ig4z55c21scrh7pfvlhqlwr1f62zlars-perl5.30.2-TermReadKey-2.38/lib/perl5/site_perl -I/nix/store/j9swz4mqx7rsb5y54a8gaaz6bhdzwqvi-perl5.30.2-Percona-Toolkit-3.0.12/lib/perl5/site_perl
Additional context
This is not working because the interpreter line contains all the imports.
If the interpreter line is < 512 (mac os limit for the interpreter line) it works.
Maybe we should look into another solution to include perl imports?
Notify maintainers
/cc @Izorkin
Metadata
- system: `"x86_64-darwin"`
- host os: `Darwin 19.5.0, macOS 10.15.5`
- multi-user?: `no`
- sandbox: `no`
- version: `nix-env (Nix) 2.3.6`
- channels(framp): `"darwin, nixpkgs-20.09pre228453.dcb64ea42e6"`
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
- nixpkgs: `/Users/framp/.nix-defexpr/channels/nixpkgs`
Maintainer information:
# a list of nixos modules affected by the problem
module:
- perl530Packages.PerconaToolkit
- I assume any other perl script exposed as an executable with a long enough import list
Sorry, i don't know how to fix it.
See shortenPerlShebang in https://nixos.org/nixpkgs/manual/#sec-language-perl
That did the trick, thanks!
I have a PR which should work, I'll test it asap and send it
https://github.com/framp/nixpkgs/commit/d7c88aec98de2b6cb01bd5de2190ce7538fbba77
This package is also broken on linux for similar reasons
Testing on master at 7887081737bbffc96c3a810a271fce252c356168
$ nix run -f . perl530Packages.PerconaToolkit -c pt-kill
/nix/store/66hc282zl28zfr8727i681vz23bqwp16-coreutils-8.31/bin/env: ‘perl -I/nix/store/kfrlhcjp3hp7vs83y701xzd542k8sm7k-perl-5.30.3/lib/perl5/site_perl -I/nix/store/5mjxg7f5lmfxrcvc02bf6lvagkrchbqd-perl5.30.3-DBD-mysql-4.050/lib/perl5/site_perl -I/nix/sto’: No such file or directory
/nix/store/66hc282zl28zfr8727i681vz23bqwp16-coreutils-8.31/bin/env: use -[v]S to pass options in shebang lines
Thanks for confirming it doesn't work on linux, I removed the isDarwin check from my PR
Most helpful comment
That did the trick, thanks!
I have a PR which should work, I'll test it asap and send it
https://github.com/framp/nixpkgs/commit/d7c88aec98de2b6cb01bd5de2190ce7538fbba77