Skip to content
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

cmd.cmd in the pre-built package for Windows sets MODULESHOME incorrectly in certain cases #525

Closed
v-clone opened this issue Feb 22, 2024 · 1 comment
Labels
Milestone

Comments

@v-clone
Copy link

v-clone commented Feb 22, 2024

Description

Depending on the actual name of the top-level directory where the pre-built package for Windows is unpacked into, the line in the cmd.cmd that sets the MODULESHOME environment variable may set the variable to the wrong value.

To Reproduce

  • Download, for example, the pre-built package for Windows called modules-5.3.1-win.zip.
  • Unzip into a folder with the same name e.g. c:\temp\modules\modules-5.3.1-win
  • Run cmd.cmd
$ c:\temp\modules\modules-5.3.1-win\init\cmd.cmd
couldn't read file "c:\temp\modules\modules-5.3\libexe\modulecmd.tcl

Notice how it seems to be thinking that one of the path segments is "modules-5.3", when it should be "modules-5.3.1-win"

Comment

The issue seems to be in the following line in cmd.cmd:

for %%i in ("%~dp0..") do set "MODULESHOME=%%~dpni"

The "~dpni" seems to be treating ".1-win" as an extension and so that portion gets lost.

A solution could possibly be to use "~dpnxi" instead.

@v-clone v-clone added the bug label Feb 22, 2024
@xdelaruelle
Copy link
Member

Many thanks for you clear report. I will apply the fix you propose.

@xdelaruelle xdelaruelle added this to the 5.5.0 milestone Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants