Fork me on GitHub
#cherry
<
2023-12-05
>
pez09:12:16

I can’t build cherry. As with the squint repo, there’s an fsck error when cloning. I can get past it by skipping the check:

~/Projects
❯ git clone 
Cloning into 'cherry'...
remote: Enumerating objects: 2915, done.
remote: Counting objects: 100% (306/306), done.
remote: Compressing objects: 100% (151/151), done.
error: object 3ebf8cb9f283e531f511a78f3198bd0050b452f8: zeroPaddedFilemode: contains zero-padded file modes
fatal: fsck error in packed object
fatal: fetch-pack: invalid index-pack output

~/Projects
❯ git clone -c fetch.fsckObjects=false -c transfer.fsckObjects=false [email protected]:PEZ/cherry.git
But then, when clojure clones the dependency on squint, it runs into the fsck error and my git/deps fu ends somewhere there…

borkdude09:12:51

I've seen reports about this before, but not sure how to best fix it.

borkdude09:12:03

with that workaround, you're able to build?

pez09:12:42

I can clone cherry, but not build it, because it bails when cloning the squint dependency.

borkdude09:12:46

I'm open to fix, not sure what it should be :(

borkdude09:12:33

FWIW CI never has this problem and it clones those repos over and over

borkdude09:12:34

@U0ETXRFEW Perhaps git config --global fsck.zeroPaddedFilemode = ignore

borkdude09:12:36

works for you

borkdude09:12:09

sorry, without the =:

git config --global fsck.zeroPaddedFilemode ignore

pez09:12:13

It looks like it is something with one of these files:

~/Projects/cherry  main[✔]
❯ git cat-file -p 3ebf8cb9f283e531f511a78f3198bd0050b452f8
100644 blob af24f6d2b22ff4ce4a6e990a59c3007b5e72b91b	README.markdown
100644 blob e3e62315330b8e13f4edb2db791950c45e43287d	project.clj
040000 tree 49d841d491ca05a36948eb6bedd8503cd51c9c4e	src
040000 tree 7a73a6de405c5df7b1221548a3c24c0972955d34	test

~/Projects/cherry  main[✔]
❯ git fsck --full
Checking object directories: 100% (256/256), done.
warning in tree 3ebf8cb9f283e531f511a78f3198bd0050b452f8: zeroPaddedFilemode: contains zero-padded file modes
Checking objects: 100% (2915/2915), done.

borkdude09:12:39

try the global option perhaps

pez09:12:33

It doesn’t help:

❯ bb dev
Cloning: 
Error building classpath. Unable to clone /Users/pez/.gitlibs/_repos/https/github.com/squint-cljs/squint
error: object 3ebf8cb9f283e531f511a78f3198bd0050b452f8: zeroPaddedFilemode: contains zero-padded file modes
fatal: fsck error in packed object
fatal: fetch-pack: invalid index-pack output
Exception in thread "main" clojure.lang.ExceptionInfo:  babashka.process.Process@ea71d3b1
	at babashka.process$check.invokeStatic(process.cljc:111)
    ...

borkdude09:12:50

can you show what's in your .gitconfig on the last line?

borkdude09:12:55

just double-checking

borkdude09:12:05

I have (now):

[fsck]
	zeroPaddedFilemode = ignore

pez09:12:39

I too. 😃

borkdude09:12:46

ok that wasn't it then

borkdude09:12:42

try:

fetch.fsck.zeroPaddedFilemode=warn

borkdude09:12:23

no idea how to set that globally

pez09:12:31

I’ll see if I can fix the tree object in my fork.

borkdude09:12:21

there is a way to log messages of tools.deps git stuff

borkdude09:12:28

GIT_DEBUG=true or so, where is this documented

borkdude09:12:33

try export GITLIBS_DEBUG=true

borkdude09:12:22

you can also try export GITLIBS_COMMAND=git --config fsck.zeroPaddedFilemode=ignore, not sure if that will work

borkdude09:12:13

no don't do that, it doesn't work

borkdude09:12:50

borkdude@m1 ~ $ rm -rf ~/.gitlibs
borkdude@m1 ~ $ bb -Sdeps '{:deps {io.github.squint-cljs/cherry {:git/sha "cd88cf45a2dad0928319d5a919e03ea7c21997d4"}}}'
Cloning: 
Checking out:  at cd88cf45a2dad0928319d5a919e03ea7c21997d4
Cloning: 
Checking out:  at 1094991e151f1d3271da5ad96e601f2e0be60a56
Babashka v1.3.187-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

borkdude09:12:47

I don't know how to repro this

borkdude09:12:57

is there anything in your .gitconfig around this fsck?

pez09:12:20

Indeed.

[transfer]
	fsckObjects = true
Removing that makes the cloning work.

pez09:12:14

I have no recollection of why I had that in the config so it is probably OK to run without it. 😃

borkdude10:12:17

btw I've started using vscode for javascript now since emacs absolutely sucks out of the box for big javascript files

pez10:12:02

I should go back to work with my js-repl! 😃

pez10:12:08

Having worked around the fsck problem, I now run into a new issue trying to hack on cherry:

~/Projects/cherry  main[✔] 
❯ bb dev       
shadow-cljs - config: /Users/pez/Projects/cherry/shadow-cljs.edn
shadow-cljs - starting via "clojure"
Error building classpath. Local lib io.github.squint-cljs/squint not found: /Users/borkdude/dev/squint
More of the error -> 🧵

pez10:12:17

----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  
Data:     {:proc #object[java.lang.ProcessImpl 0x250982 "Process[pid=50628, exitValue=1]"], :exit 1, :in #object[java.lang.ProcessBuilder$NullOutputStream 0x3e6e8737 "java.lang.ProcessBuilder$NullOutputStream@3e6e8737"], :out #object[java.lang.ProcessBuilder$NullInputStream 0x5e8022c2 "java.lang.ProcessBuilder$NullInputStream@5e8022c2"], :err #object[java.lang.ProcessBuilder$NullInputStream 0x5e8022c2 "java.lang.ProcessBuilder$NullInputStream@5e8022c2"], :prev nil, :cmd ["npx" "shadow-cljs" "--aliases" ":dev" "--config-merge" ".work/config-merge.edn" "watch" "cherry"], :type :babashka.process/error}
Location: /Users/pez/Projects/cherry/bb/tasks.clj:69:3

----- Context ------------------------------------------------------------------
65: (defn watch-cherry []
66:   (fs/delete-tree ".shadow-cljs/builds/clava/dev/ana/cherry")
67:   (fs/create-dirs ".work")
68:   (spit ".work/config-merge.edn" (shadow-extra-test-config))
69:   (shell "npx shadow-cljs --aliases :dev --config-merge .work/config-merge.edn watch cherry"))
      ^--- 
70: 
71: (defn test-cherry []
72:   (fs/create-dirs ".work")
73:   (spit ".work/config-merge.edn" (shadow-extra-test-config))
74:   (shell "npm install")

----- Stack trace --------------------------------------------------------------
babashka.process/check                    - <built-in>
babashka.process/shell                    - <built-in>
clojure.core/apply                        - <built-in>
babashka.impl.process/shell               - <built-in>
tasks/watch-cherry                        - /Users/pez/Projects/cherry/bb/tasks.clj:69:3
tasks/watch-cherry                        - /Users/pez/Projects/cherry/bb/tasks.clj:65:1
user-20b5d805-2c1a-4841-9a84-7c85b02f83c1 - <expr>:26:1

borkdude10:12:27

Error building classpath. Local lib io.github.squint-cljs/squint not found: /Users/borkdude/dev/squint

pez10:12:28

It’s the :dev alias. If I point it to my local squint I get:

❯ bb dev
Error building classpath. Could not find artifact orkdude:edamame:jar:1.0.0 in central ()
Exception in thread "main" clojure.lang.ExceptionInfo:  babashka.process.Process@80cb2894

borkdude10:12:42

Maybe you have screwed with ~/.gitlibs?

borkdude10:12:51

Try

rm -rf ~/.gitlibs

pez10:12:16

Well, I haven’t, but I’m happy to wipe it 😃 brb with results

borkdude10:12:34

also try

bb -Sforce dev
perhaps it helps

borkdude10:12:59

Error building classpath. Could not find artifact orkdude:edamame:jar:1.0.0 in central 
This seems to be a weird error orkdude? without a b?

👀 1
pez10:12:53

Ah, fat fingers. I blame the flu.

pez10:12:16

Now it works. So only the :dev alias that should be mentioned somewhere?

borkdude10:12:56

I don't follow. Can you start over?

borkdude10:12:52

do you mean some docs are missing?

borkdude10:12:48

btw, now published squint 0.4.73 with non-empty

pez10:12:49

deps.edn has a :dev alias that won’t work on other machine but yours. I worked around it like so:

❯ git diff deps.edn 
diff --git a/deps.edn b/deps.edn
index 7fa1b67..9850764 100644
--- a/deps.edn
+++ b/deps.edn
@@ -9,7 +9,7 @@
 
  :aliases
  {:dev {:extra-deps {io.github.squint-cljs/squint
-                     {:local/root "/Users/borkdude/dev/squint"}}}
+                     {:local/root "/Users/pez/Projects/squint"}}}
   :cljs {:extra-paths ["test"]
          :extra-deps {thheller/shadow-cljs {:mvn/version "2.25.10"}}}
   :test ;; added by neil

borkdude10:12:19

so bb dev doesn't work on your machine, is that what it is? sorry to hear that, I should fix it :)

pez10:12:07

It works with the fix. 😃

borkdude10:12:03

hmm, actually this might be a feature, since you often need to have squint checked out as well when working on squint, so maybe I can change the local/root to ".."

borkdude10:12:19

or just remove the alias here: npx shadow-cljs --aliases :dev

borkdude10:12:34

let me just do that actually, I don't use the dev alias

borkdude10:12:45

I usually manuallly switch between local/root

pez10:12:18

Thanks! Fixes it.

😅 1
pez10:12:33

I want to experiment with different boilerplates in my local playground (which I use by opening index.html in a browser). Specifically the AOC boilerplate. Where should I be looking?

borkdude10:12:19

You can specify a boilerplate=<url> in the address bar

👀 1
borkdude11:12:49

do you understand it? I cannot tell considering the 👀 emoji

borkdude11:12:00

The url:

contains a query param boilerplate=

borkdude11:12:19

it simply points to a page which returns cljs code

borkdude11:12:26

this code is pre-loaded and not shown in the editor

borkdude11:12:59

this allows you to customize the playground to your likings, without even running a cherry build ;)

pez11:12:02

I see. I confused it with src, but now I think I get how it works.

borkdude11:12:28

the whole AOC playground is just a boilerplate + the vanilla editor

pez11:12:41

Yeah, haha, I worked hard to get the cherry build going, and then it was just opening index.html 😃

borkdude11:12:24

now let's see if I can fix that annoying coercive-boolean

pez11:12:33

But if I hack on cherry any, how do I get the playground to use it? Edit the imports?

borkdude11:12:48

just http-server --dir . and open the index page :)

borkdude11:12:55

it's automatically using the dev version in localhost

borkdude11:12:04

unless you specify dev=false on the url bar

borkdude11:12:25

I'm trying to reproduce the issue. I do see coercive-boolean in this result:

but the evaluation doesn't seem to be bothered

pez11:12:21

Yeah, that works fine…

borkdude11:12:23

ah I can repro with:

(coordinates-covered
    {:number "467",:from [0 0],:to [5 0]

borkdude11:12:29

from your solution

pez11:12:04

So in the failed repro attempt coercive_boolean was never called?

borkdude11:12:30

yeah, it seems so but the above repros it, so I have something to write a test for

borkdude12:12:02

tiniest repro: (for [x (range 0 1)] x)

pez12:12:53

Can you explain? 😃

borkdude12:12:17

it's just the for macro expanding into this code and cherry doesn't have that macro yet

borkdude13:12:44

@U0ETXRFEW ok, added coercive-boolean and more coercive-stuff. you can see what happens here when you replace coercive-boolean with do in the output:

you can see that there is an extra truthiness check when you don't include it. so coercive-boolean functions as a hint to the compiler that the truthiness check can be omitted

🙏 1
pez15:12:02

What if we add a convenience button for creating a blank #C0GLTDB2T playground? I had some troubles figuring out how to do that, yesterday. Also suggested in the video is a bit of instructions around sharing.

borkdude15:12:10

sounds good, PR welcome (both to squint and cherry, code is almost the same)

👍 1
pez16:12:20

The message about saving the session cookie could include something about that if you see a message TypeError: Failed to fetch, it is because session wasn’t saved. (This for the boilerplate code.)

borkdude16:12:10

yes, or the boilerplate should be changed to give a better error message

borkdude16:12:18

let me do that right now

pez16:12:35

Failed to Advent of Code token! does not compute 😃

borkdude16:12:20

somehow with the latest change I get all kinds of scrollbars when the code output is large:

borkdude16:12:01

what is 90dvh?

pez17:12:48

It’s dynamic view height. Makes it handle mobile browser widgetery better.

pez17:12:29

The view heights can be set to s, l, and d. Smallest, largest and some smart combo.

borkdude17:12:35

I undid your change and added your change back until I saw no more scrollbars. I will try d again

borkdude17:12:08

pushed, can you check?

borkdude17:12:19

still welcome to propose changes, but next time I should review the PR better locally

borkdude17:12:18

(sorry, I force pushed)

pez17:12:28

Did I fry the scrollbars? Of the compiled output?

borkdude17:12:43

with your change scrollbars appeared, so above screenshot

borkdude17:12:06

this was especially visible on my tiny 13" screen :)

pez17:12:34

I see. I’ll pull the changes and apply them to the squint update.

pez17:12:32

No sharing instructions. But fewer scrollbars, for sure. 😃

borkdude17:12:53

Isn't "share" obvious enough?

pez17:12:16

It wasn’t to me. I had no idea what was happening.

pez17:12:45

But I have the flu, so maybe not the best Ux tester.

borkdude17:12:46

maybe a tooltip is a good idea

pez17:12:10

I can try that.

pez17:12:13

Yeah, works. Better than nothing, me thinks.

pez17:12:40

I happen to be a fan of CTA:s too 😃

pez17:12:57

Call to action.

borkdude17:12:03

PR with CTA welcome :)

pez17:12:16

😃 coming up