-
Notifications
You must be signed in to change notification settings - Fork 118
follow Lmod rules for path updates #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
15731e6
041b33a
9f5864b
cf424aa
37ed41b
76b8dea
8b0e5d1
101ed8a
6d8e491
7bf3a19
ddc1d4a
5964ceb
e48dea7
6b06afc
a82c71b
8af7c95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1816,27 +1816,43 @@ proc add-path {cmd mode dflbhv args} { | |
| set val [get-env $var] | ||
|
|
||
| foreach dir $path_list { | ||
| if {![info exists countarr($dir)] || $allow_dup} { | ||
| # remove $dir from path only if path_entry_reorder is true and | ||
| # $dir is already in path and duplicates are NOT allowed. | ||
| if {[getConf path_entry_reorder] && [info exists countarr($dir)]\ | ||
| && ! $allow_dup} { | ||
| set mpath_list [split $val $separator] | ||
| set mpath_list [lsearch -inline -all -not -exact $mpath_list $dir] | ||
| set val [join $mpath_list $separator] | ||
| } | ||
| # add $dir to beginning or end only if path_entry_reorder is true or | ||
| # $dir is NOT in path or duplicates are allowed. | ||
| # Please note: if path_entry_reorder is true and duplicates are not | ||
| # allowed, $dir is not in path ($val) - either it was not in or it | ||
| # had been removed. Hence we have to add it. | ||
| if {[getConf path_entry_reorder] || ![info exists countarr($dir)]\ | ||
| || $allow_dup} { | ||
| # ignore env var set empty if no empty entry found in reference | ||
| # counter array (sometimes var is cleared by setting it empty not | ||
| # unsetting it) | ||
| if {$val ne {} || [info exists countarr()]} { | ||
| set sep [expr {$val eq $separator ? {} : $separator}] | ||
| set val [expr {$bhv eq {prepend} ? "$dir$sep$val" :\ | ||
| "$val$sep$dir"}] | ||
| "$val$sep$dir"}] | ||
| } else { | ||
| set val $dir | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the condition introduced above to set |
||
| if {[info exists countarr($dir)]} { | ||
| # do not increase counter if bare separator string is added or if | ||
| # reference count is ignored (--ignore-refcount set) unless if | ||
| # duplicate mode is enabled (--duplicates set) | ||
| if {!$val_set_is_delim && (!$ign_refcount || $allow_dup)} { | ||
| incr countarr($dir) | ||
| } | ||
| } else { | ||
| #### ref-counting | ||
| # if $dir is NOT in path | ||
| # set ref-count 1 | ||
| # else | ||
| # do NOT increase counter if bare separator string is added or if | ||
| # reference count is ignored (--ignore-refcount set) unless if | ||
| # duplicate mode is enabled (--duplicates set) | ||
| if {![info exists countarr($dir)]} { | ||
| set countarr($dir) 1 | ||
| } elseif {!$val_set_is_delim && (!$ign_refcount || $allow_dup)} { | ||
| incr countarr($dir) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -2054,7 +2070,10 @@ proc getModulesEnvVarGlobList {{loaded_ctx 0}} { | |
| return $envvar_glob_list | ||
| } | ||
|
|
||
| # ;;; Local Variables: *** | ||
| # ;;; mode:tcl *** | ||
| # ;;; End: *** | ||
| # ;;; Local Variables: | ||
| # ;;; Mode: tcl-mode | ||
| # ;;; tcl-indent-level: 3 | ||
| # ;;; tcl-continued-indent-level: 3 | ||
| # ;;; indent-tabs-mode: nil | ||
| # ;;; End: | ||
| # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3148,7 +3148,10 @@ proc cmdModuleSpider {show_oneperline show_mtime show_filter search_filter\ | |
| $search_match $modpath_list {*}$args | ||
| } | ||
|
|
||
| # ;;; Local Variables: *** | ||
| # ;;; mode:tcl *** | ||
| # ;;; End: *** | ||
| # ;;; Local Variables: | ||
| # ;;; Mode: tcl-mode | ||
| # ;;; tcl-indent-level: 3 | ||
| # ;;; tcl-continued-indent-level: 3 | ||
| # ;;; indent-tabs-mode: nil | ||
| # ;;; End: | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Emacs is not happy with the trailing
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that |
||
| # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if dir is NOT in path || duplicates are allowed, there is no need to check the state of path_entry_reorder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without checking the state of
path_entry_reorder. It can happen, that$diris removed but not added again. Ifpath_entry_reorderis true and$diris added twice,$dirwill be removed in the second call but not added again, becausecountarr($dir)exists and$allow_dupis false.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be interesting to add a specific test for the case you describe, for future refactoring not to miss that point