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:

❤️ 3
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 3
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.

❤️ 3
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. 😀

😁 3
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!

👋 3
pez20:05:46

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

😃 3
pez20:05:05

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

alexandergunnarson20:05:52

Super appreciate you fighting the good fight ⚔️

6
pez20:05:44

At least the error you are experiencing probably has a solution.

🙏 3
alexandergunnarson20:05:42

I’m hoping so — it’s really quite a strange heisenbug

alexandergunnarson20:05:41

I’ve done literally the same steps 5 times in the past few minutes and have gotten different results each time. One time Calva spontaneously seemed to be doing just fine. The other times Calva broke in the places it has usually broken for me, but at different points

alexandergunnarson20:05:18

Trying to see if there’s some really subtle inconsistency on my end, like a timing issue or like having a file open in two places in VSCode or whatever

pez20:05:19

Have you run it as many times using CIDER? (so that we know we have a model to follow).

alexandergunnarson20:05:50

About 3-4x in CIDER, all consistently fine

alexandergunnarson20:05:06

About 15+ in VSCode integrated terminal with nREPL, also consistently fine

alexandergunnarson20:05:22

I’ll keep doing tests

pez20:05:12

It’s probably the case that we do something strange in Calva.

alexandergunnarson20:05:46

Quite possible. Right now I’m thinking it’s a timing issue but I’ll keep you posted.

pez20:05:48

Better than doing all those tests would be if you added a missing feature to Calva, that CIDER has.

alexandergunnarson20:05:00

Which missing feature?

pez20:05:20

CIDER has a feature for tracing the nrepl messages and responses.

pez20:05:35

Should have added that to Calva long ago.

alexandergunnarson20:05:59

How easy to add? I don’t have much time left today to spend on editor debugging issues unfortunately

alexandergunnarson20:05:05

Will be more free tomorrow

pez20:05:29

There is no hurry as we have been missing the feature for years. 😃

pez20:05:25

I think it should be reasonably easy. There is oen place where messages are sent, and one where they are received. CIDER prints it nicely with -> and <- markers.

pez20:05:13

Every time I’ve needed it I have debugged printed instead. But it would be so much better to be able to ask the users for a log like that instead.

alexandergunnarson20:05:04

Ah man, this really is a true heisenbug — this time I made sure to connect Calva only after the server-REPL finished evaluating and loading some stuff. Then I evaluated, using Calva commands, the same files as before (which are in the same position in the same VSCode windows), in the same order

alexandergunnarson20:05:24

I can’t imagine what’s going wrong or why it spontaneously is fine sometimes

alexandergunnarson20:05:50

Yeah probably time to debug this stuff using what you’re describing. I’m not sure how to hack on Calva or what’s involved. I’ll have to do some reading

pez20:05:32

See the wiki for “How to Hack on Calva”. It is quite easy, I think. (But I do it all the time, so maybe not the best judge)

alexandergunnarson20:05:04

I figured there’d be a wiki — thanks for putting it together 🙂

alexandergunnarson20:05:45

I’ll dive into it tomorrow, but for this REPL session the heisenbug has not surfaced and I’m just going to run with that for now 🤞

alexandergunnarson20:05:28

Ah dang it. Resurfaced. Back to VSCode integrated terminal till tomorrow 😞

pez20:05:13

I’ve just assumed from your name that you live in Sweden, but now checking, Slack tells me you are in the US?

pez20:05:15

(Checked because it seemed you were planning to work for a while longer even though it is late here. 😃 )

🌘 3
alexandergunnarson21:05:55

Oh haha yes, in the US 😄

alexandergunnarson21:05:21

My great-grandparents dropped the additional “s” from the name (Gunnarsson) when they immigrated :flag-se:🇺🇸

alexandergunnarson21:05:56

I’m sure Swedes everywhere are shocked at the name butchery 😂

pez21:05:28

Haha, there is much similar name butchery going on here as well.

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.

🎉 4