Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 827152 - dev-util/hermes: generates scripts with unprefixed shebangs on prefix, which breaks e.g. testing lmod with FEATURES=test
Summary: dev-util/hermes: generates scripts with unprefixed shebangs on prefix, which ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-24 14:52 UTC by Bob Dröge
Modified: 2021-11-25 14:03 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for prefixifying the shebangs of test scripts generated by Hermes (dev-util-hermes_prefixify_shebangs.patch,1.36 KB, patch)
2021-11-25 08:23 UTC, Bob Dröge
Details | Diff
Output for emerging the patched dev-util/hermes and sys-cluster/lmod (emerge_hermes_lmod.log,167.37 KB, text/x-log)
2021-11-25 08:30 UTC, Bob Dröge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Dröge 2021-11-24 14:52:30 UTC
I was trying to run the Lmod test suite inside Prefix on different architectures, but ran into an issue with a specific test that had a hardcoded /bin/tcsh shebang, which was not available on my host machine. While trying to fix that one using hprefixify, I noticed that for all the other (~120) tests, test scripts with a /bin/bash shebang are automatically generated by the Hermes (dev-util/hermes) testing framework. Though this was not causing issues for me, it's probably not nice/clean that it's using the host's bash.

So, I want to propose two fixes:

1)
Add an "inherit prefix" and the following to the hermes ebuild, in order to always generate the right shebangs for the test scripts:
        hprefixify -w '/#\!\/bin\/bash/' tm/Tst.lua || die

2) Fix the broken Lmod test that uses /bin/tcsh (this is test csh_swap) by adding this to the Lmod ebuild:
        hprefixify -w '/#\!\/bin\/tcsh/' rt/csh_swap/csh_swap.tdesc || die
Or, even more generic, in case future tests will use some other non-bash shell:
        hprefixify -w '/#\!\/bin\//' rt/*/*.tdesc || die

I've tested this on x86_64, and by using these fixes, all tests completed in a Prefix environment.

Reproducible: Always

Steps to Reproduce:
1. Make sure that the host system does not have /bin/tcsh 
2. Use features=TEST for sys-cluster/lmod
3. emerge sys-cluster/lmod
Actual Results:  
The test csh_swap will fail.

Expected Results:  
All tests successfully complete.
Comment 1 Bob Dröge 2021-11-24 15:03:33 UTC
Some references that I forgot to include:

This is the actual Hermes file that generates the shebang, which is hardcoded to /bin/bash:
https://github.com/TACC/Hermes/blob/master/tm/Tst.lua#L94

This is the directory which contains the Lmod test descriptions:
https://github.com/TACC/Lmod/tree/8.5.6/rt

The one that failed due to a missing tcsh on the host, is the following one, which generates a custom test scripts in the test description file, which is why it has to be patched separately:
https://github.com/TACC/Lmod/blob/8.5.6/rt/csh_swap/csh_swap.tdesc#L30
Comment 2 Bob Dröge 2021-11-25 08:23:01 UTC
Created attachment 756187 [details, diff]
Patch for prefixifying the shebangs of test scripts generated by Hermes

The patch also includes an additional fix for lmod, which uses Hermes for testing, but it has one test with a hardcoded tcsh shebang; that one gets prefixified as well.
Comment 3 Bob Dröge 2021-11-25 08:30:03 UTC
Created attachment 756235 [details]
Output for emerging the patched dev-util/hermes and sys-cluster/lmod

Also includes the test output of Lmod, which now passes all the tests.

While the tests were running, I checked one of the Lmod test scripts (which are generated by Hermes), and it now shows the correct shebang:

$ head -n 1 /cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/x86_64/var/tmp/portage/sys-cluster/lmod-8.5.6/work/Lmod-8.5.6/rt/hidden/t1/2021_11_25_08_26_32-Linux-x86_64-hidden/t1.script
#!/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/x86_64/bin/bash
Comment 4 Larry the Git Cow gentoo-dev 2021-11-25 14:03:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25dc0e214245fa10f3f89b8d91631bd535dc018c

commit 25dc0e214245fa10f3f89b8d91631bd535dc018c
Author:     Bob Dröge <b.e.droge@rug.nl>
AuthorDate: 2021-11-25 13:17:06 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2021-11-25 14:02:41 +0000

    dev-util/hermes: fix bug 827152
    
    Closes: https://bugs.gentoo.org/827152
    Package-Manager: Portage-3.0.28, Repoman-3.0.3
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 dev-util/hermes/hermes-2.8_p20180315.ebuild | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c78b9de8b1ddc158726693813bf1de6b52f405a1

commit c78b9de8b1ddc158726693813bf1de6b52f405a1
Author:     Bob Dröge <b.e.droge@rug.nl>
AuthorDate: 2021-11-25 13:48:36 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2021-11-25 14:02:41 +0000

    sys-cluster/lmod: fix tests on prefix
    
    Bug: https://bugs.gentoo.org/827152
    Package-Manager: Portage-3.0.28, Repoman-3.0.3
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 sys-cluster/lmod/lmod-8.5.6.ebuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)