Hello Paul, Xavier,
By asking this naive question, I was not expecting that it would be so complex to handle 😊
With respect to Paul's trials, I would like also to report that when MANPATH is blank, "man" command behaves as if undefined and seems to use "manpath" to search for man pages.
So defining MANPATH to ":" would be one good solution. The thing is that I can do that in my own tcshrc script but I'll never be able to convince our IT to change tcsh init script for the all the machines. But adding this line in Modules etc/initrc file seems to be a way to go:
prepend-path MANPATH ":"
Best regards,
Laurent.
-----Message d'origine-----
De : Xavier Delaruelle <xav...@gm...>
Envoyé : samedi 22 février 2025 08:38
À : Environment Modules usage and discussion. <mod...@li...>
Objet : Re: [Modules] Issue around MANPATH in Modules 5.5.0
I have just created an enhancement issue to track this need [1].
It should be feasible to add new configuration option to set the initial value of path-like environment variable.
With such feature, an initial value for MANPATH could be set at ./configure time or within etc/initrc. This initial value may be the result value returned by the manpath command.
module config init_MANPATH [exec -ignorestderr manpath]
Best regards,
Xavier
[1] https://github.com/envmodules/modules/issues/572
Le ven. 21 févr. 2025 à 18:44, Paul Markfort <pau...@gm...<mailto:pau...@gm...>> a écrit :
>
> MANPATH and modules is a complicated issue.
>
> I just tested, and initiating MANPATH to ":" sort of works.
> Unfortunately when you unload all the modules that change MANPATH, MANPATH ends up unset.
> I loaded one module that prepends, and one that appends, unloaded them both and MANPATH ended up blank.
>
> If I set it to "::" it is preserved through the load/unload.
> (I have been doing something similar since Modules 3, as even Modules 3 doesn't seem to actually handle MANPATH correctly).
>
> So, you should initialize with MANPATH="::"
>
> Perhaps another feature is needed in Modules: Assume MANPATH (and possibly other variables used like it) are ":" when blank.
>
> Example:
> if MANPATH is blank, then:
> prepend-path MANPATH /usr/man
> Results in: MANPATH="/usr/man:"
>
> Modules currently handles MANPATH correctly once the : is set.
> For instance, starting with the above setting of: MANPATH="/usr/man:"
> append-path MANPATH /usr/local/man
> Results in: MANPATH="/usr/man::/usr/local/man"
>
> (note if you start with "::", the append prepend sequence above,
> currently ends up as MANPATH="/usr/man::::/usr/local/man")
>
>
>
> NOTE: LD_LIBRARY_PATH is a variable that should NEVER be handled this way, as it assumes a blank directory path is the current directory (at least the man page for ld.so says it does - although not covered in the man page, it always searches the default paths after searching LD_LIBRARY_PATH).
>
>
> On 2025-02-21 12:40 AM, Xavier Delaruelle wrote:
> > Dear Laurent and Paul,
> >
> > The difference between the 2 implementations is that Modules 3 sets
> > MANPATH to "/usr/share/man:/usr/local/share/man" when it initializes
> > this environment variable.
> >
> > Modules 4 and newer versions do not perform any specific setup based
> > on environment variable name.
> >
> > What I suggest for MANPATH is to initialize this environment
> > variable to ":" to ask man to look at system man paths (what returns
> > manpath by
> > default) in addition to looking at specific paths enabled by
> > modulefiles. This initialization may be done within the etc/initrc
> > file.
> >
> > Best regards,
> > Xavier
> >
> > Le jeu. 20 févr. 2025 à 15:23, Paul Markfort <pau...@gm...<mailto:pau...@gm...>> a écrit :
> >>
> >> Interesting.
> >>
> >> It looks like you are installing from source (by the install location).
> >>
> >> When I installed 5.5.0, I used the config options:
> >> --disable-set-binpath --disable-set-manpath Maybe you need to use:
> >> --disable-set-binpath
> >>
> >>
> >> My copy (as installed) looks exactly like the below in that section (it is completely commented out).
> >>
> >>
> >> if {[getState shelltype] in {sh csh fish}} {
> >> # add Modules bin directory to PATH if enabled but do not increase ref
> >> # counter variable if already there
> >> ##nagelfar ignore #26 Strange command
> >> #if {{/stage/site/modules/5.5.0/bin} ni [split [get-env PATH] :]} {
> >> #prepend-path --ignore-refcount PATH {/stage/site/modules/5.5.0/bin}
> >> #}
> >>
> >> # add Modules man directory to MANPATH if enabled
> >> # initialize MANPATH if not set with a value that preserves manpath
> >> # system configuration even after addition of paths to this variable by
> >> # modulefiles
> >> #set manpath {}
> >> # use manpath tool if found at configure step, use MANPATH otherwise
> >> ##nagelfar ignore +2 Too long line
> >> ##nagelfar ignore Found constant
> >> #catch {set manpath [exec -ignorestderr 2>/dev/null manpath]}
> >> ##if {[isEnvVarDefined MANPATH]} {
> >> ## set manpath $::env(MANPATH)
> >> ##}
> >> #if {{/stage/site/modules/5.5.0/share/man} ni [split $manpath :]} {
> >> # if {![isEnvVarDefined MANPATH]} {
> >> # append-path MANPATH {}
> >> # # ensure no duplicate ':' is set
> >> # } elseif {[envVarEquals MANPATH :]} {
> >> # remove-path MANPATH {}
> >> # append-path MANPATH {}
> >> # }
> >> # prepend-path MANPATH {/stage/site/modules/5.5.0/share/man}
> >> #}
> >> }
> >>
> >> On 2025-02-20 3:20 AM, Laurent BESSON wrote:
> >>> Hello dear Modules community,
> >>>
> >>> I’m facing a strange « bug » (or « feature 😊) in Modules 5.5.0 around the definition of MANPATH variable.
> >>>
> >>> A bit of context before : I’m running under Redhat 7 Entreprise
> >>> edition. My shell is tcsh. By default, module 3.2.0 is
> >>> inititialized (defined by root in /etc/ csh.cshrc) but I’m forcing
> >>> a swith to 5.5.0 in my own .tcshrc
> >>>
> >>> Before loading any modules, the MANPATH variable is undefined. « manpath » command is returning :
> >>>
> >>> In module 3.2.0 environnment :
> >>> /usr/local/share/man:/usr/share/man/overrides:/usr/share/man
> >>> In module 5.5.0 environnment :
> >>> /home/lbesson/Tools/Modules/5.5.0/share/man:/usr/local/share/man:/
> >>> usr/share/man/overrides:/usr/share/man:/home/lbesson/share/man:/dp
> >>> t/adh/flow/digital/man
> >>>
> >>> In module 3.2.0 environnment , $PATH is returning :
> >>> /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/us
> >>> r/bin:/sbin:/bin:/usr/X11R6/bin
> >>> In module 5.5.0 environnment :
> >>> /home/lbesson/Tools/Modules/5.5.0/bin:/usr/lib64/qt-3.3/bin:/usr/l
> >>> ocal/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/
> >>> bin
> >>>
> >>> Then, I’m loading a module which is adding/defining the MANPATH like this :
> >>>
> >>> prepend-path MANPATH /tool/platform/lsf/8.0/man
> >>>
> >>> After this module load, in Modules 3.2.0, MANPATH value is :
> >>>
> >>> /tool/platform/lsf/8.0/man:/usr/share/man:/usr/local/share/man
> >>>
> >>> While in Modules 5.5.0, I get this :
> >>>
> >>> /tool/platform/lsf/8.0/man
> >>>
> >>> In that case, a simple « man ls » is returning : « No manual entry for ls » . Too bad !
> >>>
> >>>
> >>> When looking at the modulecmd.tcl code in 5.5.0, around line number 18266, I see this (I have removed comments to compact the lines) :
> >>>
> >>> if {{/home/lbesson/Tools/Modules/5.5.0/bin} ni [split [get-env PATH] :]} {
> >>> prepend-path --ignore-refcount PATH {/home/lbesson/Tools/Modules/5.5.0/bin}
> >>> }
> >>>
> >>> set manpath {}
> >>> catch {set manpath [exec -ignorestderr 2>/dev/null manpath]}
> >>> if {{/home/lbesson/Tools/Modules/5.5.0/share/man} ni [split $manpath :]} {
> >>> if {![isEnvVarDefined MANPATH]} {
> >>> append-path MANPATH {}
> >>> } elseif {[envVarEquals MANPATH :]} {
> >>> remove-path MANPATH {}
> >>> append-path MANPATH {}
> >>> }
> >>> prepend-path MANPATH {/home/lbesson/Tools/Modules/5.5.0/share/man}
> >>> }
> >>>
> >>> I think adding « /home/lbesson/Tools/Modules/5.5.0/bin » in $PATH
> >>> has made « manapth » to return
> >>>
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> Modules-interest mailing list
> >>> Mod...@li...<mailto:Mod...@li...>
> >>> https://lists.sourceforge.net/lists/listinfo/modules-interest
> >>>
> >>
> >> --
> >> --------------------------------------------------------
> >> The views and opinions expressed above are strictly those of the
> >> author(s). The content of this message has not been reviewed nor
> >> approved by any entity whatsoever.
> >> --------------------------------------------------------
> >> Paul FM Info: http://paulfm.com/~paulfm/
> >> --------------------------------------------------------
> >>
> >>
> >> _______________________________________________
> >> Modules-interest mailing list
> >> Mod...@li...<mailto:Mod...@li...>
> >> https://lists.sourceforge.net/lists/listinfo/modules-interest
> >
> >
> > _______________________________________________
> > Modules-interest mailing list
> > Mod...@li...<mailto:Mod...@li...>
> > https://lists.sourceforge.net/lists/listinfo/modules-interest
> >
>
> --
> --------------------------------------------------------
> The views and opinions expressed above are strictly those of the
> author(s). The content of this message has not been reviewed nor
> approved by any entity whatsoever.
> --------------------------------------------------------
> Paul FM Info: http://paulfm.com/~paulfm/
> --------------------------------------------------------
>
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...<mailto:Mod...@li...>
> https://lists.sourceforge.net/lists/listinfo/modules-interest
_______________________________________________
Modules-interest mailing list
Mod...@li...<mailto:Mod...@li...>
https://lists.sourceforge.net/lists/listinfo/modules-interest
|