babashka

teodorlu 2026-01-04T09:20:01.479089Z

A part of me thought that "relativizing against empty" should make no changes, therefore (fs/relativize "" "/assets/script.js") returns "/assets/script.js" unchanged. Currently, it throws on empty string argument and on nil. I'm not completely sold on this, though, maybe explicit throwing is less likely to cause bugs. Edit: After consideration, I like the current, explicit behavior better. I retract my idea, have a nice Sunday!

teodorlu 2026-01-04T09:20:11.235669Z

Current behavior:

(fs/relativize "" "/assets/script.js")
;; => Execution error (IllegalArgumentException) at sun.nio.fs.UnixPath/relativize (UnixPath.java:485).
;;    'other' is different type of Path

(fs/relativize nil "/assets/script.js")
;; => Execution error (NullPointerException) at babashka.fs/as-path (fs.cljc:40).
;;    Cannot invoke "java.io.File.toPath()" because the return value of "clojure.lang.IFn.invoke(Object)" is null

teodorlu 2026-01-04T09:25:56.867009Z

Bah, I retract my suggestion. Cute idea, I like explicit better. Nothing to see here!

Mario G 2026-01-04T10:22:06.049919Z

OMG, somebody on the internet that doesn't hold strong opinions forever and is open about changing their mind! πŸ˜‰πŸ‘

teodorlu 2026-01-04T13:54:40.587249Z

we may all try to carry the "care about problems, not solutions!" torch Rich gave us!

✌️ 1
lread 2026-01-04T16:21:22.007699Z

I'm not sure if you know this (https://github.com/babashka/fs/issues/152!), but the underlying JDK APIs typically treat "" as the current working directory. So "" is typically treated as ".".

(fs/same-file? "." "")
;; => true
(fs/same-file? "./" "")
;; => true
So the thrown error you are getting is the same you'd get for:
(fs/relativize "." "/assets/script.js")
;; => Execution error (IllegalArgumentException) at sun.nio.fs.UnixPath/relativize (UnixPath.java:485).
;;    'other' is different type of Path
Which is really just saying "I can't relativize a relative path against an absolute path".

teodorlu 2026-01-04T16:46:39.396589Z

Ah! Today I learned, thank you. In that case it makes absolute sense that we should leave the current API absolutely unchanged (relative to my point of view).

lread 2026-01-04T16:58:39.031249Z

> relative to my point of view Absolutely! πŸ₯

πŸ’₯ 1
❀️ 1
agorgl 2026-01-04T12:46:07.133299Z

Hello! Using babashka with clojure.tools.logging and timbre leads to pretty long startup time. I assumed it would be fast given both of them are baked in. A simple POC follows:

#!/usr/bin/env bb
(ns script
  (:require
   [clojure.tools.logging :as log]
   [taoensso.timbre :as timbre]))

(defn -main [& args]
  (log/info "Hello there"))

(when (= *file* (System/getProperty "babashka.file"))
  (apply -main *command-line-args*))

; vim: set ft=clojure:

βœ… 1
borkdude 2026-01-04T12:46:58.244269Z

I don't see anything abnormal

$ time bb /tmp/foo.clj
2026-01-04T12:46:41.523Z MBP25-2.local INFO [script] - Hello there
bb /tmp/foo.clj   0,01s  user 0,01s system 73% cpu 0,029 total

agorgl 2026-01-04T12:48:41.014259Z

I beg to differ πŸ™‚ :

> time bb foo.clj
2026-01-04T12:48:59.964Z UnknownHost INFO [script] - Hello there
bb foo.clj  0.00s user 0.01s system 0% cpu 5.018 total

agorgl 2026-01-04T12:49:46.837339Z

also for context:

> bb --version
babashka v1.12.213

borkdude 2026-01-04T12:50:13.077389Z

$ /opt/homebrew/bin/bb /tmp/foo.clj
2026-01-04T12:49:57.094Z MBP25-2.local INFO [script] - Hello there

$ /opt/homebrew/bin/bb --version /tmp/foo.clj
babashka v1.12.213

borkdude 2026-01-04T12:50:27.776319Z

It probably has to do with you not having set the host name

borkdude 2026-01-04T12:50:42.802359Z

timbre does an API call to get the host name and this times out after 5s or so

borkdude 2026-01-04T12:50:59.409609Z

it came up before in this channel

agorgl 2026-01-04T12:51:27.862609Z

I do have the hostname set. I reproduced this in two different linux distros / machines too, both Arch and Bazzite

borkdude 2026-01-04T12:51:40.721919Z

"UnknownHost"

borkdude 2026-01-04T12:53:39.501769Z

read here for a previous conversation on this: https://clojurians.slack.com/archives/CLX41ASCS/p1700744390336579?thread_ts=1700659069.699279&cid=CLX41ASCS

borkdude 2026-01-04T12:54:21.754269Z

> summary: my hostname in /etc/hostname was blackdog, but this was not entered into /etc/hosts

agorgl 2026-01-04T12:56:08.699649Z

well, adding my hostname to /etc/hosts solved the issue thanks πŸ™‚

agorgl 2026-01-04T12:56:25.847919Z

kinda weird that logging relies to dns lookups

borkdude 2026-01-04T12:56:48.548779Z

We should add a FAQ on this in the babashka book I guess

borkdude 2026-01-04T12:56:52.886699Z

PR welcome :)

agorgl 2026-01-04T12:59:07.747629Z

Given that there isn't a FAQ section, is a logging recipe with the above hint good enough?

borkdude 2026-01-04T12:59:26.227109Z

We should probably add a Troubleshooting section

borkdude 2026-01-04T12:59:49.283729Z

just making an issue for it is also fine

agorgl 2026-01-04T13:05:56.389999Z

done https://github.com/babashka/book/issues/85

❀️ 2
borkdude 2026-01-22T08:06:11.035099Z

@brandon268 have you left this feedback for timbre itself too? @ptaoussanis #timbre

brandonvin 2026-01-22T08:11:32.830029Z

I remember it was reported as a github issue. I'm not finding it at the moment, though

brandonvin 2026-01-22T08:12:18.522459Z

Oh, I see. It was specifically in slf4j-timbre: https://github.com/fzakaria/slf4j-timbre/issues/40

Peter Taoussanis 2026-01-22T11:32:43.692489Z

@brandon268 Yes, please note that this doesn’t seem to have been an issue with Timbre, but with a 3rd-party library (slf4j-timbre). Timbre v6.6+ includes an official SLF4Jv2 backend provider that should offer significantly better performance. @borkdude Thanks for looping me in on this πŸ‘ > timbre does an API call to get the host name and this times out after 5s or so Just confirming that this is correct, and would explain the slow startup. https://github.com/taoensso/telemere provides an https://github.com/taoensso/telemere/issues/68 to disable hostname info but this might not be relevant since I believe Telemere doesn’t currently support Babashka.

πŸ‘ 1
brandonvin 2026-01-22T07:57:45.680239Z

Huh, wow. Fun fact, one point a few years ago we adopted timbre for logging, and it ended up causing a catastrophic perf degradation - some code deep in timbre was constructing exceptions constantly in order to get stack traces and evaluate whether a particular logger was enabled or not (it was, in fact, disabled, and not logging anything). That was a fun one to track down...

seancorfield 2026-01-04T23:44:10.739349Z

I just tried brew update && brew upgrade and got failures for both Babashka and clj-kondo -- any ideas/suggestion? This is on Ubuntu 20.04. Deets in 🧡

seancorfield 2026-01-04T23:44:26.696869Z

✘ Formula babashka (1.12.213)
Error: Failed to download resource "babashka (1.12.213)"
Download failed: 
✘ Formula clj-kondo (2025.12.23)
Error: Failed to download resource "clj-kondo (2025.12.23)"
Download failed: 
==> Upgrading borkdude/brew/babashka
  1.12.212 -> 1.12.213
==> Downloading 
-=O=-                                                                                                           #   # ##-=O=-                                                                                                              # ###-=O=-                                                                                                               ####curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number                                          ##

Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "babashka (1.12.213)"
Download failed: 

seancorfield 2026-01-05T01:00:33.429419Z

Hmm, the root cause seems related to the old Ubuntu 20.04 version I'm using, and the old curl. But after trying everything that Copilot recommended, and ensuring I have an updated curl and that brew is using it, it still bails with the same ssl3_get_record error 😞

seancorfield 2026-01-05T01:06:15.331489Z

The download URL redirects to location: https://release-assets.githubusercontent.com/github-production-release-asset/... and that is the URL that brew fails to negotiate TLS with.

2026-01-05T01:45:11.536239Z

I seem to remember that Ubuntu has a CA certs package that you can update

2026-01-05T01:48:49.738949Z

ca-certificates

seancorfield 2026-01-05T02:14:05.573599Z

Yeah, tried that too. Copilot/OpenAI eventually guided me to a solution...

seancorfield 2026-01-05T02:15:32.874509Z

βœ… Solution: it seems my ISP is hijacking DNS lookups. I installed the cloudflared DNS proxy and configured WSL2 to use that, to force DNS-over-HTTPS in a way that Armstrong (ISP) cannot hijack.

😒 1
seancorfield 2026-01-05T02:28:48.060379Z

This seems to have speeded up a lot of my network requests on WSL2 as well πŸ™‚

seancorfield 2026-01-05T02:57:48.529919Z

Weirdly, it only seems to happen on my Windows Laptop 3, not my Dell Inspiron 7700 desktop -- on the same WiFi network, even tho' they are configured identically as far as I can tell. I hate network sh*t 😞

⭐ 1