This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-28
Channels
- # aws (1)
- # babashka (113)
- # beginners (41)
- # cider (9)
- # cljdoc (15)
- # cljs-dev (8)
- # cljsrn (5)
- # clojure (113)
- # clojure-australia (4)
- # clojure-europe (40)
- # clojure-nl (8)
- # clojure-taiwan (1)
- # clojure-uk (60)
- # clojurescript (59)
- # code-reviews (2)
- # conjure (1)
- # datahike (12)
- # events (1)
- # jobs (1)
- # kaocha (4)
- # lsp (24)
- # luminus (19)
- # malli (4)
- # off-topic (28)
- # pathom (10)
- # philosophy (1)
- # portal (6)
- # re-frame (3)
- # reagent (9)
- # remote-jobs (1)
- # shadow-cljs (31)
- # sql (24)
- # tools-deps (6)
- # xtdb (14)
Is there a way to get that fs/delete
function to work using a relative path? Something like this:
(shell/with-sh-dir root-dir
(fs/delete (fs/path "foo")))
clojure.java.shell
and babashka.fs
are two different libraries, with-sh-dir
doesn't affect fs/delete
Is there a way for me to create a single exe out of babashka + my scripts (perhaps cli-matic based) .. I want to do this because I want to distribute a tool to some of the engineers to execute certain commands against our production cluster (with a single file its convenient, just put it in path). They have permissions and everything, the scripts just simplify certain flows. I found this: https://github.com/MnRA/nativity which I will give it a try. I was wondering if there's some in-built way of doing so.
You could convert your script to a GraalVM project but I think just letting them download babashka is the easiest
For a single file uberscript might be useful, right? https://book.babashka.org/#_uberscript
yes, but then you still need babashka to execute it. I think @U052521SY wants a single executable with all sources included
Another approach: https://gist.github.com/thiagokokada/115b2588ff65a48d54b8832488801c92
This gist downloads Babashka to $HOME/.bb
, if it doesn't exist, and re-exec the file as a Babashka script
Very nice, thanks for all the insights, much appreciated. I will take a look at these sources and see what I come up with 🙂
Hi all, @borkdude will be talking about Babashka tasks at the London Clojurians meetup in July https://www.meetup.com/London-Clojurians/events/278466747/

@borkdude install script failed on one of my systems because of the default_download_dir="/tmp"
as on the system there is no write access to /tmp
I was wondering if you could do 1) use TMPDIR
environment variable (as described https://en.wikipedia.org/wiki/TMPDIR) 2) allow option to specify location for temporary files 3) both 1 and 2. Should I open ticket for it?
@ales.najmann the script has a --download-dir
option
but we could actually change the default to $TMPDIR
, that's probably better, I will do that now
there is issue that some of distros actualy don't set it up... so it's one of those cases wher POSIX tells something, but systems don't respect it generally
I think it's ok to not have a support for this... as I can always say: --download-dir=$TMPDIR from the outside
btw if you're interested what I wanted to try... I wanted to install bb to Termux on Android
if GraalVM supported linking with musl on aarch64 then this would be no problem, but it currently doesn't cc @UFDRD93RR @U7ERLH6JX
you could read in this topic: https://github.com/babashka/babashka/issues/241#issuecomment-804721420
This sums the differences pretty well: https://wiki.termux.com/wiki/Differences_from_Linux
> if GraalVM supported linking with musl on aarch64 maybe if its possible to get a graal to just emit the object file for aarch64, not do the full link, MAYBE we could figure out the rest of the linkage with musl.a for aarch64 instead of letting graal do the link. in theory this should work
very very off the top of my head, very possible none of it works 😅
good weekend project for me it seems
Hmm, I'm seeing a new --target
argument:
--target selects native-image compilation target (in <OS>-<architecture>
format). Defaults to host's OS-architecture pair.
one can hope!
@ales.najmann did you manage to run bb in Termux?
if you're getting Bad system call
, then first try running termux-chroot
command and then execute bb
. It might help (it did for me - Android 10.
@U01LFP3LA6P ok, it works... thank you fellow citizen! 🙂
No problem. Now tell me what's your plan with bb on termux 😉. I have a feeling that having an option to execute bb
on your android phone/tablet (via termux) might be opening a huge amount of new possibilities. But I haven't discovered them yet 😄. Tried running http server from @U0522TWDA and it works flawlessly. It even opens a chrome browser and navigates to the server page.
well, well. I'm still just playing around with Clojure and Babashka is just another option to explore Lisp world.

@borkdude About the TMPDIR
issue. Maybe it is better to create the temporary directory using mktemp
instead. At least on Linux, it does the correct thing. From the documentation:
if DIR is not specified, use $TMPDIR if set, else /tmp
@ales.najmann I don't think this is the issue of linking with glibc, I think this is a SELinux issue
https://github.com/MasterDevX/Termux-Java/issues/3#issuecomment-548653884
To fix it, install proot
, run proot -0
and try to run ./bb
again
@UFDRD93RR I believe you, it makes sense.
> Maybe it is better to create the temporary directory using mktemp instead. Looking at the macOS manpage it also seems to do the correct thing there: https://ss64.com/osx/mktemp.html > mktemp will generate a template string based on the prefix and the CSDARWIN_USER_TEMP_DIR configuration variable if available. Fallback locations if CSDARWIN_USER_TEMP_DIR is not available are TMPDIR and /tmp. I can open a PR if you want
Can you test it @ales.najmann? I remember testing it in the past, not sure if this is still the fix. But maybe if this is really "the fix" for now, we could document this somewhere
TIL, surprised to discover that mktemp
is not POSIX, but seems to be supported everywhere we care: https://stackoverflow.com/a/2792789
(Also, coreutils, busybox and toybox includes it, so pretty much any Linux distribution will have it too)
Just need to take care about the flags, but -d
flag seems to be supported anywhere (the flag we care for this case)
SELinux ready I would say. Babashka can be now installed with curl on nuclear power plan without any concerns 🙂
@UFDRD93RR I assume you tested the script locally.. correct?
ok, if @ales.najmann gives the OK, I'll merge :)
> This script is btw a remarkable example of why bb exists in the first place Yeah, exactly I have a similar script to bootstrap Babashka automatically in a project of mine. It is three times bigger than the rest of the init code of the project, most by trying to make it "safe"
Just a correction: the "Bad system call" issue is related to seccomp
enforcement on newer Android versions, not SELinux
: https://toybox.landley.narkive.com/v0fQYJw7/android-o-xargs-bad-system-call#post8
And using termux-chroot
seems to be better than proot -0
(it is available by installing the same package)
Since I can't edit the Wiki to add this, here is a documentation about this part:
# Running Babashka on Android with Termux
You can run the static builds of Babashka on Android inside Termux. However if you're using Android 8.0+, you may have the following error while trying to run them:
`
$ ./bb
Bad system call
`
This happens because of `seccomp` rules enforcement on newer versions of Android, as can be seem on [this link]().
As a workaround, you can run Babashka inside `proot`, an user-space implementation of `chroot`. To do this, run:
`
$ pkg install proot
$ termux-chroot
$ ./bb
`
Note that only basic functionality was tested and this is completely unsupported.
It might be better to add this to http://book.babashka.org?
or yeah, since this is experimental, let's do the wiki. or you can just post it on Github discussions
I need to debug some of the http requests I'm making with http-kit.client bundled with babashka - is there a way to pass the `
-Djavax.net.debug=all
flag somehow?@lukaszkorecki you should be able to pass JVM opts as the first args to bb
it seems to work here:
$ bb -Djavax.net.debug=all -e '(do @(org.httpkit.client/get "") nil)'
Ah, bummer - the option works, but it's not what I need - this only prints SSL/TLS diagnostic info, I just need to debug the actual request being sent
@lukaszkorecki does httpkit document that this option should work for debugging its request?
I assume this isn't included in bb: https://clojars.org/http-kit.debug