clj-on-windows 2021-05-25

There is a difference between windows/linux in how :jvm-opts args in aliases are picked up:

PS C:\Users\Vlaaad\Projects\repro> Get-Content .\deps.edn
{:aliases {:opt {:jvm-opts ["-Drepro.opt=YES"]
                 :exec-fn checkopt/exec}}}
PS C:\Users\Vlaaad\Projects\repro> Get-Content .\src\checkopt.clj
(ns checkopt)

(defn exec [_]
  (prn (System/getProperty "repro.opt")))
PS C:\Users\Vlaaad\Projects\repro> clj -X:opt
nil
PS C:\Users\Vlaaad\Projects\repro> wsl
vlaaad@asus-notebook:/mnt/c/Users/Vlaaad/Projects/repro$ clj -X:opt
"YES"
vlaaad@asus-notebook:/mnt/c/Users/Vlaaad/Projects/repro$

Using version "1.10.3.849" both on windows and linux

@vlaaad for completeness, could you also try with bb clojure -X:opt ?

(with a newer version of bb)

I don't use bb, sorry @borkdude

this could be interesting to find out if it's a powershell issue or something else

since bb uses the exact same code, not platform specific

(this is the same code as used in bb, but a standalone executable dedicated to only this)

just a suggestion for debugging

Alex Miller (Clojure team) 2021-05-25T20:33:28.010100Z

can you also retry the repro with -Sforce in both cases to make sure there are no cache effects

Alex Miller (Clojure team) 2021-05-25T20:33:42.010400Z

or rm .cpcache/

@alexmiller same result:

PS C:\Users\Vlaaad\Projects\repro> clj -Sforce -X:opt
nil
PS C:\Users\Vlaaad\Projects\repro> wsl
vlaaad@asus-notebook:/mnt/c/Users/Vlaaad/Projects/repro$ clj -Sforce -X:opt
"YES"

@vlaaad what Java versions are you using in both envs?

I know there is an issue with Oracle 15+ that is dropping quotes on Windows, which is why I am asking.

@borkdude

temp $ bb clojure -X:opt
"YES"

temp $ clj -X:opt
nil

temp $ java -version
openjdk version "16" 2021-03-16
OpenJDK Runtime Environment AdoptOpenJDK (build 16+36)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 16+36, mixed mode, sharing)

is this windows or wsl

Windows + Powershell

and what do you get for clj ?

temp $ clj -X:opt
nil

@borkdude 14.0.1 on windows and 11.0.11 on linux

which vendors? please more info :)

Alex Miller (Clojure team) 2021-05-25T21:25:10.015Z

on the linux one, if you add -Sverbose you'll see a line like "cp_file = .cpcache/4068492893.cp". for whatever that hash value is can you cat .cpcache/HASH.jvm

Alex Miller (Clojure team) 2021-05-25T21:30:50.017200Z

I can't actually repro this on mac

Alex Miller (Clojure team) 2021-05-25T21:31:08.017800Z

which is same bash as linux

The mac powershell parses differently than the windows one. The windows one splits -X:foo into two args -X: and foo (or perhaps the colon on the other side)

Alex Miller (Clojure team) 2021-05-25T21:31:34.018700Z

the parsing is intentionally different in windows due to the : stuff

that parsing is only different in windows + powershell.

not in cmd.exe

Alex Miller (Clojure team) 2021-05-25T21:33:17.020300Z

not sure I'm following

the mac powershell parses it "correctly" but the windows powershell (specifically: windows AND powershell, that specific combination) parse -F:foo into two parts

Alex Miller (Clojure team) 2021-05-25T21:33:47.021400Z

to be clear, you are off on a side quest here from the original question about linux -X not picking up :jvm-opts, right?

it works ok on Linux (or WSL), the same does not on Windows

Alex Miller (Clojure team) 2021-05-25T21:35:07.022900Z

well now I'm totally confused

it does work ok with tools.deps.alpha on Windows, just not with the powershell front-end

I'll back off now ;)

Alex Miller (Clojure team) 2021-05-25T21:36:12.024200Z

rereading, I had the problem completely backwards, sorry

Alex Miller (Clojure team) 2021-05-25T21:36:24.024600Z

I thought it was linux not working and windows working

damn Windows once again 🙂

Alex Miller (Clojure team) 2021-05-25T21:37:36.025400Z

so, I would actually like to know the answer to the .jvm file question I asked above

(and the vendor of both the JVMs, which could also be a difference, as shown in the adventures of @pez)

Alex Miller (Clojure team) 2021-05-25T21:38:21.026600Z

if you clj -Sverbose -X:opt then grab the hash and look at .cpcache/HASH.jvm

Alex Miller (Clojure team) 2021-05-25T21:39:39.027500Z

what I am trying to see is whether the make-classpath program is properly understanding the alias and writing the cache file OR whether the problem is in reading the file and applying the jvm properties in the pwsh

@alexmiller

temp $ clj -Sverbose -X:opt
version      = 1.10.3.849
install_dir  = C:\Users\alesn\scoop\modules\ClojureTools
config_dir   = C:\Users\alesn\.clojure
config_paths = C:\Users\alesn\scoop\modules\ClojureTools\deps.edn C:\Users\alesn\.clojure\deps.edn deps.edn
cache_dir    = .cpcache
cp_file      = .cpcache\9A0695B47F76E40743FC037AEAF297A7.cp
nil

temp $ Get-Content .\.cpcache\9A0695B47F76E40743FC037AEAF297A7.jvm   
-Drepro.opt=YES

Alex Miller (Clojure team) 2021-05-25T21:41:19.028500Z

actually I'm pretty sure it's the latter - this is just missing on the exec branch

Alex Miller (Clojure team) 2021-05-25T21:45:35.029200Z

give me a minute, and I'll have a build for you

Alex Miller (Clojure team) 2021-05-25T21:46:14.029500Z

ok, grab the windows build version 1.10.3.855 and give it a try

🚀 1

Ok. I'm wrestling now with scoop... but it's already downloading the right thing

temp $ clj -Sverbose -X:opt
version      = 1.10.3.855
install_dir  = C:\Users\alesn\scoop\modules\ClojureTools
config_dir   = C:\Users\alesn\.clojure
config_paths = C:\Users\alesn\scoop\modules\ClojureTools\deps.edn C:\Users\alesn\.clojure\deps.edn deps.edn
cache_dir    = .cpcache
cp_file      = .cpcache\9A0695B47F76E40743FC037AEAF297A7.cp
"YES"
temp $ bb clojure -X:opt
"YES"

🎉 2
Alex Miller (Clojure team) 2021-05-25T21:55:51.031Z

YES YES YES

Alex Miller (Clojure team) 2021-05-25T21:55:57.031400Z

such positive affirmations in this test

I'm glad another clj on windows issue got solved today. YES!

autoupdate script parses release page, so after the update of this page https://clojure.org/releases/tools fix can make it to users

I wonder if I can use brew-install release page to check for releases

@ales.najmann maybe checking the tags here works better? https://github.com/clojure/brew-install/releases github has an API for this

yes, I believe scoop github actions actually use this internally.

Alex Miller (Clojure team) 2021-05-25T22:13:43.036400Z

the tags there are ALL releases, both prerelease and stable

you can flag prereleases as such in github

Alex Miller (Clojure team) 2021-05-25T22:15:13.036800Z

I'm using git programatically, not github

I'll probably stick to release page then

Alex Miller (Clojure team) 2021-05-25T22:16:20.037600Z

and really the homebrew repo makes no distinction - there is a tag for every @version release of the formula

Alex Miller (Clojure team) 2021-05-25T22:16:45.037800Z

"stable" is a subset of those where we bump the default clojure.rb formula

you can also use github programmatically, I've scripted (almost) all my binary uploads to github releases now: releases are created automatically, or only added to if they already exists, etc

so should I realy point to repo with clojure.rb formula?

Alex Miller (Clojure team) 2021-05-25T22:17:14.038400Z

oh sorry, you're looking at brew-install, same difference I guess

Alex Miller (Clojure team) 2021-05-25T22:18:30.038600Z

I don't want to flag releases differently on brew-install though - I don't know at the time of tagging whether it will be a stable release or not

Alex Miller (Clojure team) 2021-05-25T22:18:55.038800Z

promotion to stable is a separate process as far as I'm concerned

no worries. I'll stick to release page (as a changelog) it was working fine for months.

and it's safe

Alex Miller (Clojure team) 2021-05-25T22:20:33.039400Z

I think the best things to look at are either the stable.properties file in brew-install (somewhat annoying due to the changing branch name, which I may end up changing as its a pain elsewhere) or to watch the clojure.rb formula in the homebrew-tools repo

Alex Miller (Clojure team) 2021-05-25T22:20:47.039600Z

also, I've updated the release page

it will be autoupdated in ~45-60 minutes

Thank you for the debugging session 🙂 it was nice

@borkdude

scoop-clojure master = $ checkver

cmdlet checkver.ps1 at command pipeline position 1
Supply values for the following parameters:
Dir: bucket
clojure: 1.10.3.855 (scoop version is 1.10.3.849) autoupdate available
clojure-lsp: 2021.05.22-16.50.45
deps.clj: 0.0.15
datalevin: 0.4.34
jet: 0.0.15
bb-web: 0.2.4
puget: 0.0.3
carve: 0.0.2
lmgrep: 2021.05.23
pgmig: 0.7.0
bootleg: 0.1.9
babashka: 0.4.3
pathom-viz: 2021.5.13
clj-kondo: 2021.04.23
joker: 0.17.1

🎉 1

but I need to let Excavator (github-action) to process it on scheduled time (~0 minute every hour)