Fork me on GitHub
#calva
<
2021-05-01
>
pez10:05:48

I tried to summarize some of what I know so far here https://github.com/BetterThanTomorrow/calva/issues/1162#issuecomment-830609242 Pasted it in this post too for easy access. @flowthing: Can you add the workaround that worked on your colleague’s machine to the issue?

flowthing10:05:17

Will do. 👍:skin-tone-2:

❤️ 1
borkdude11:05:57

I left a couple of hints here: https://github.com/BetterThanTomorrow/calva/issues/1162#issuecomment-830616904 Don't give up @pez, we will win the war on quoting.

metal 1
borkdude11:05:37

@pez Could you explain what cmd.exe and Powershell have to do with this? Are users launching this getting started REPL manually from their shells?

pez11:05:47

I commented on that thing on the issue. Not sure it answers your question. Getting Started REPL is using Jack-in under the hood though. And almost the same thing happens when jacking in to a deps.edn project. For the latter we quite often advice people who wan to start the REPL themselves and connect instead to copy the command line echoed. Calva even has a command for copying out the jack-in command line.

borkdude11:05:14

I reacted. I don't think you need the shell option.

pez11:05:48

It is currently the only option where it works on my machines right now, so it will stay used until we have figured out the non-shell way of doing it.

pez11:05:09

The shell option.

borkdude11:05:17

I mean the second it

pez11:05:29

The shell option. 😃

borkdude11:05:56

It is currentl the only option where "the shell option" works on my machines right now?

pez11:05:59

The third it is Getting Started REPL. 😃

pez11:05:54

Ah, so there are more its… Hmm. 1. The shell option 2. Getting Started REPL 3. The shell option 4. Getting Started REPL

borkdude11:05:05

The shell option launches the default system shell to run your command. This is not necessary when you launch an executable like java. Moreover it will introduce these shell and platform-specific quoting issues, rather than solving them. But whatever you want :)

pez11:05:11

It is not a matter of what I want. Don’t you agree that I should keep doing something that works for 90% of the cases over something that works for 0%?

borkdude11:05:32

I don't agree with using the shell option when it's completely unnecessary.

borkdude11:05:37

But it's your tool

pez11:05:08

I think we don’t understand each other right now. Unnecessary?

borkdude11:05:27

You want to launch a java subprocess. Not a shell subprocess which launches a java subprocess (with quoting issues).

pez11:05:44

Yes. Agreed. That is what I want.

pez11:05:50

I also want it to work.

borkdude11:05:30

Note that when you want to launch the official clojure CLI, then you do need the shell option, because powershell....

borkdude11:05:41

but for launching java, you do not need it

pez11:05:54

Well, I have put launcing the official Clojure CLI on hold for now.

borkdude11:05:10

Here is an example of how to launch a binary: https://github.com/marcomorain/clojure-lint/blob/86f699258d7478d44237241ecf1f0be914170887/src/extension.ts#L55 and how to find it, in a cross platform way.

borkdude11:05:16

Good luck, afk now.

❤️ 1
pez15:05:58

So, been at this a bit more now. I might have tried more quoting variants than any other coder ever existing. None of those worked. But all is not lost. I think I have found another solution. If I use CMD-style quoting and write the command line to a .cmd file, then execute that file, the jack-in succeeds. OnMyMachine, yes, but I don’t see why that shouldn’t work on any machine, even in a world as crazy as Windows.

Stuart16:05:24

installing now

Stuart16:05:54

> 01/05/2021 17:19:19 - Microsoft VSIX Installer > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:19 - vsixinstaller.exe version: > 01/05/2021 17:19:19 - 16.9.1028 > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:19 - Command line parameters: > 01/05/2021 17:19:19 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\stuarts\Downloads\calva-2.0.195-1162-getting-started-repl-win-514800ae.vsix > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:19 - Microsoft VSIX Installer > 01/05/2021 17:19:19 - ------------------------------------------- > 01/05/2021 17:19:25 - Initializing Install... > 01/05/2021 17:19:25 - Microsoft.VisualStudio.ExtensionManager.InvalidExtensionManifestException: Element 'Identity' has invalid value for attribute 'Version' ---> System.FormatException: Input string was not in a correct format. > at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument) > at System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent) > at System.Version.TryParseVersion(String version, VersionResult& result) > at System.Version.Parse(String input) > at System.Version..ctor(String version) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.<>c.<ExtractManifestData>b__67_1(String s) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.VerifyStringValue[T](String value, ErrorInfo info, Func`2 selector, Boolean isRequired, Int32 maxLength, T defaultValue) > --- End of inner exception stack trace --- > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.VerifyStringValue[T](String value, ErrorInfo info, Func`2 selector, Boolean isRequired, Int32 maxLength, T defaultValue) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.ExtractManifestData(PackageManifest manifest) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.ReadPackageManifest(XmlReader reader) > at Microsoft.VisualStudio.ExtensionManager.ExtensionImpl.ReadManifest(Stream manifestStream) > at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl.ReadVSIXManifestFromPackage(Stream stream, CultureInfo preferredCulture) > at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl..ctor(String path, CultureInfo preferredCulture) > at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.CreateInstallableExtension(String extensionPath, CultureInfo preferredCulture) > at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.CreateInstallableExtension(String extensionPath) > at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData) > at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported) > at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported) > at VSIXInstaller.App.Initialize(Boolean isRepairSupported) > at VSIXInstaller.App.Initialize() > at System.Threading.Tasks.Task`1.InnerInvoke() > at System.Threading.Tasks.Task.Execute()

Stuart16:05:05

Did i do something wrong?

pez16:05:49

I don’t think so. Seen it before though. Let me see if it installs cleanly on my machine….

pez16:05:55

Hmmm, no problem here. As I said, I think I have seen similar before. Don’t remember who it was… Maybe try downloading it again?

Stuart16:05:42

ok, i think i did do somethign stupid. I think I have .vsix associated with visual studio

Stuart16:05:54

installing it via plugins > add from vsix in VSCode worked

Stuart16:05:13

My calva now reports v2.0.195-1162-getting-started-repl-win-514800ae

Stuart16:05:56

same error

Stuart16:05:59

c:\Users\stuarts\AppData\Local\Temp\betterthantomorrow.calva\8mdqdl>java -jar .calva\deps.clj.jar -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" 
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.25.11}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1

pez16:05:43

That doesn’t look like the new version. Which version does the Extension pane say you are using?

borkdude16:05:20

@pez Have you also tried without the shell option?

borkdude16:05:48

But without the shell option, I expect you won't need any quoting

pez16:05:57

Thats the only variant I haven't tested yet. There is still hope!

borkdude17:05:05

if that doesn't work, can you also try execFile like here? https://github.com/marcomorain/clojure-lint/blob/86f699258d7478d44237241ecf1f0be914170887/src/extension.ts#L55 No processing of the args, just pass them raw

borkdude16:05:13

(off topic: Now that rewrite-clj also supports CLJS I guess we could also have a cljstyle that works in the browser and nodeJS)

pez16:05:26

I have tried only without the shell option. 😃

borkdude16:05:15

@pez :) Then why does @qmstuart print output like 'c:\Users\stuarts\AppData\Local\Temp\betterthantomorrow.calva\8mdqdl>'. That looks like a shell to me

pez16:05:12

And as I said, it doesn’t look like from the new VSIX. 😃

Stuart16:05:36

@pez, is that screenshot showig the version you expect after installing the new vsix?

pez16:05:39

Yes, that is the correct version. Very strange….

pez16:05:50

Should look like so.

Stuart16:05:56

Here's what I'm doing / seeing

pez16:05:22

Ah, but now it is the right version at least. Just that it still doesn’t work even with this strategy. Very disappointing!

pez16:05:05

And now need to go afk. Will have to investigate this further later…

Stuart16:05:22

This is what my Jack in dependency versions settings look like for reference

stianalmaas17:05:37

Hello guys. I have also tested the new version and I have exactly the same behaviour as Stuart. Which is good, I think. Our machines behave the same way. .calva\jack-in.cmd c:\Users\stian\AppData\Local\Temp\betterthantomorrow.calva\sqv3zo>java -jar .calva\deps.clj.jar -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.26.0""}}}" -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.26.0}}}": java.lang.NumberFormatException: Invalid number: 0.8.3 Jack-in process exited. Status: 1

stianalmaas17:05:36

The version numbers now have two double-quotes. As far as I can see everything is the same as for Stuart.

pez17:05:58

Thanks, @stianalmaas ! Yes, I find some comfort in that you two have the same resukt. 😀

😁 1
pez19:05:02

New VSIX cookin’. Are you still awake, @qmstuart and @stianalmaas? 😃

Stuart19:05:02

yeah, it's ony 8:45 here 😄

pez19:05:52

It’s probably me having had a tad wine at dinner. 😃 Haha

Stuart19:05:38

nice, i could go a gin right now, but I'm all out 😞

pez19:05:56

Here it is, I give it a 100% success prediction: (Yeah, like with the last try, but anyway). https://13280-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.195-1162-getting-started-repl-win-076d5d2f.vsix

stianalmaas19:05:08

Going for it as well

stianalmaas19:05:52

Hmm, I'm afraid I'm getting the same result: java -jar .calva\deps.clj.jar -Sdeps {:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}} -m nrepl.cmdline --middleware [cider.nrepl/cider-middleware] Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.26.0}}}": java.lang.NumberFormatException: Invalid number: 0.8.3 Jack-in process exited. Status: 1

stianalmaas19:05:30

The version is v2.0.195-1162-getting-started-repl-win-076d5d2f

Stuart19:05:23

me too

java -jar .calva\deps.clj.jar -Sdeps {:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}  -m nrepl.cmdline --middleware [cider.nrepl/cider-middleware]
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.26.0}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1
Version: v2.0.195-1162-getting-started-repl-win-076d5d2f

stianalmaas20:05:51

I can see that you've commented on this already @pez, but it seems the same problem is there for cider as well: https://github.com/clojure-emacs/cider/issues/2963

stianalmaas20:05:28

But it may be a totally different use case since it uses leiningen...

pez20:05:29

Madness.

stianalmaas20:05:31

I can see that you have been fighting this this for a long time @pez. Must be frustrating.

alexandergunnarson20:05:12

Hey @pez! 👋 Thanks for your patience over there on GitHub!

👋 1
pez20:05:46

@stianalmaas Yeah, and I keep thinking I can win, and even that I have won, which of course helps adding frustration.

😃 1
pez20:05:05

As you can see, the battle has many fronts. 😃

alexandergunnarson20:05:52

Super appreciate you fighting the good fight ⚔️

2
pez20:05:58

Which java versions are you using, @qmstuart and @stianalmaas?

stianalmaas20:05:35

java version "16" 2021-03-16 Java(TM) SE Runtime Environment (build 16+36-2231) Java HotSpot(TM) 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)

Stuart20:05:01

❯ java --version
java 15.0.2 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

pez20:05:24

Let me try with a newer Java, I think I am at 1.8 with my windows machine.

pez20:05:37

Success. (For some definition of success). With Java 16 I get the same error as @stianalmaas and @qmstuart get.

Stuart20:05:55

Thats good progress!

Stuart20:05:04

Always helps when you can repro on your machine

pez20:05:47

Indeed. Even if right now I am short of ideas. Hopefully some sleep will help replenishing.

pez20:05:21

I wonder why I didn’t suspect java version problems until now… But whatever happens, I’ve been able to simplify the construction of the jack-in command line as a result of this latest ghost chase, which makes me think it was worth it.

🎉 2