cherry 2023-12-05

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 git@github.com: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…

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

with that workaround, you're able to build?

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

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

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

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

works for you

sorry, without the =:

git config --global fsck.zeroPaddedFilemode ignore

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.

try the global option perhaps

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)
    ...

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

just double-checking

I have (now):

[fsck]
	zeroPaddedFilemode = ignore

ok that wasn't it then

try:

fetch.fsck.zeroPaddedFilemode=warn

no idea how to set that globally

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

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

GIT_DEBUG=true or so, where is this documented

try export GITLIBS_DEBUG=true

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

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

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.

I don't know how to repro this

is there anything in your .gitconfig around this fsck?

Indeed.

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

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

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

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

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 -> 🧵

----- 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

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

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

Maybe you have screwed with ~/.gitlibs?

Try

rm -rf ~/.gitlibs

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

also try

bb -Sforce dev
perhaps it helps

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

Ah, fat fingers. I blame the flu.

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

I don't follow. Can you start over?

do you mean some docs are missing?

btw, now published squint 0.4.73 with non-empty

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

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

It works with the fix. 😃

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 ".."

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

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

I usually manuallly switch between local/root

Thanks! Fixes it.

😅 1

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?

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

👀 1

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

The url:

contains a query param boilerplate=

it simply points to a page which returns cljs code

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

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

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

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

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

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

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

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

it's automatically using the dev version in localhost

unless you specify dev=false on the url bar

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

but the evaluation doesn't seem to be bothered

Yeah, that works fine…

ah I can repro with:

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

from your solution

So in the failed repro attempt coercive_boolean was never called?

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

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

Can you explain? 😃

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

@pez 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

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

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

👍 1

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.)

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

let me do that right now

Failed to Advent of Code token! does not compute 😃

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

what is 90dvh?

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

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

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

pushed, can you check?

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

(sorry, I force pushed)

Did I fry the scrollbars? Of the compiled output?

with your change scrollbars appeared, so above screenshot

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

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

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

Isn't "share" obvious enough?

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

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

maybe a tooltip is a good idea

Yeah, works. Better than nothing, me thinks.

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

PR with CTA welcome :)