mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
When manpulating path list with append-path/prepend-path/etc commands a _modshare variable is set to keep track of how many times each reference has been loaded. But if after these commands a setenv/unsetenv command is used, the _modshare variable is left alone whereas the path list variable is entirely replaced by a new value or destroyed. To sanitize this kind of situation, any existing _modshare variable is cleaned-up when the associated variable is targeted by a setenv or an unsetenv command. Non-regression tests 028-setenv-refcount and 038-unsetenv-refcount in 50-cmds suite have been added to check new behavior.