Thanks to visit codestin.com
Credit goes to github.com

Skip to content

autoinit loops when set_shell_startup is enabled #414

@xdelaruelle

Description

@xdelaruelle

In a case a modulefile executes a bash shell script to fetch a value:

$ cat foo
#%Module
exec ./bar
$ cat bar
#!/bin/bash
echo bar

If this modulefile is loaded and set_shell_startup option is enabled, any autoinit call ends in an infinite loop:

$ ps --no-headers -C tclsh | wc -l
0
$ $MODULES_CMD bash autoinit &
[1] 129648
$ ps --no-headers -C tclsh | wc -l
151
$ ps --no-headers -C tclsh | wc -l
284
$ ps --no-headers -C tclsh | wc -l
391

It appears that the bar bash script triggers an autoinit evaluation due to the set_shell_startup mechanism, and this autoinit refreshes currently loaded modules which makes the foo modulefile re-executes the bar bash script which triggers again the autoinit evaluation and so on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions