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

not a valid path: /c/Users/chris/.sdkman\var\candidates #258

Open
xpusostomos opened this issue Jul 28, 2024 · 4 comments
Open

not a valid path: /c/Users/chris/.sdkman\var\candidates #258

xpusostomos opened this issue Jul 28, 2024 · 4 comments

Comments

@xpusostomos
Copy link

I was using sdkman for many years with cygwin, it was great. Some months back, sdkman broke it, for no good reason I could see. But I was excited recently to try it again, and it 95% works! yay! Because I was lost without it.

However, this command gives an error:

$ sdk default groovy 4.0.19
thread 'main' panicked at src\lib.rs:38:13:
not a valid path: /c/Users/chris/.sdkman\var\candidates
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

@marc0der
Copy link
Member

Hi @xpusostomos, our problem is that Cygwin doesn't handle paths properly, and Rust does not support that. We now build proper Windows binaries that behave in the way that a Windows binary should, but Cygwin expects windows binaries to behave as Unix. This problem will only get worse as we port more across to Rust. I know that GitBash does the right thing and works well with SDKMAN on Windows. Alternatively, you could also try WSL2.

@xpusostomos
Copy link
Author

@marc0der having a unix shell call a windows program, is hardly natural, and I was going to respond to you along the lines of, would it kill you to use $(cygpath -w ${SOMETHING}) anytime on windows you want a windows path sent into a rust program... (alias cygpath to "echo" on other architectures)...

however....

when I try sdk on windows right now (doing an upgrade on sdk to be sure), it all works again, including "sdk default groovy blah"... so I presume someone has fixed it...

At the end of the day, bash, whether the cygwin version or not, works with the paths you give it. Cygwin works perfectly happy with C:/ as the beginning of a path, just the same as windows does. So as long as you don't contaminate your variables with a cygwinism, then you don't even need cygpath.. not that cygpath is that hard.

@marc0der
Copy link
Member

marc0der commented Aug 15, 2024

would it kill you to use (cygpath−w{SOMETHING}) anytime on windows you want a windows path sent into a rust program

We won't be sending anything to a Rust program from bash. Rust reads and builds its paths natively.

when I try sdk on windows right now (doing an upgrade on sdk to be sure), it all works again, including "sdk default groovy blah"... so I presume someone has fixed it...

I assume that your libexec folder is empty, which means that SDKMAN is falling back on the deprecated bash functions. That said, we will be removing those functions at some point as they grow out of date.

@xpusostomos
Copy link
Author

@marc0der libexec has 5 .exe programs in there. The above error I reported looks to me like a crash inside a rust program to me. If you never pass a path into rust from bash, I don't understand the complaints about cygwin paths being an issue... and at this point in history, they don't appear to be an issue. However the above error seems to indicate a cygwin path got into rust.

cygwin is a project that probably has tens of thousands of man years of development put into it. It should not be onerous to make the... apparently minimal... effort to keep it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants