EESSI / software-layer

Software layer of the EESSI project
https://eessi.github.io/docs/software_layer
GNU General Public License v2.0
24 stars 47 forks source link

long installation prefix causes trouble for Perl #154

Open boegel opened 2 years ago

boegel commented 2 years ago

While installing Perl/5.30.2-GCCcore-9.3.0 to /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/Perl/5.30.2-GCCcore-9.3.0, I ran into the following issue:

failing sanity check for 'Inline' extension: command "perldoc -lm Inline " failed; output:
/bin/bash: /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/Perl/5.30.2-GCCcore-9.3.0/bin/perldoc:
/cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/Perl/5.30.2-GCCcore-9.3.0/bin: 
bad interpreter: Permission denied (at easybuild/framework/easyblock.py:3311 in _sanity_check_step)

The problem here is that the shebang line in perldoc is too long, there's a strict limit of ~128 characters in shebang lines in shell scripts:

$ head -1 /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/Perl/5.30.2-GCCcore-9.3.0/bin/perldoc
#!/cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/Perl/5.30.2-GCCcore-9.3.0/bin/perl

$ echo '/cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/Perl/5.30.2-GCCcore-9.3.0/bin/perl' | wc -c
131

This should probably be fixed in the Perl easyblock in EasyBuild: if the installation directory is too long, EasyBuild could replace the excessive long shebang with #!/usr/bin/env perl (or #!<sysroot>/usr/bin/env perl)

boegel commented 2 years ago

Workaround for this is implemented in Perl easyblock: https://github.com/easybuilders/easybuild-easyblocks/pull/2640

We should also update our EasyBuild configuration though, to use --env-for-shebang=$EPREFIX/usr/bin/env, to avoid that /usr/bin/env (provided by the host rather than the compat layer) is used, just to be on the safe side...

I'll also implement that in EasyBuild framework to make that automatic: use <sysroot>/usr/bin/env as value for env-for-shebang, unless a value is already specified that starts with <sysroot>...