Fork me on GitHub
#babashka
<
2020-12-23
>
crimeminister00:12:30

Hey folks, before I open an issue, has anyone else encountered this when using bb v0.2.5?

19:35 $ bb
Babashka v0.2.5 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (require '[babashka.curl])
nil
user=> (curl/get "")
Segmentation fault (core dumped)
The backtrace looks like:
(gdb) bt
#0  0x00007ffff4c5496e in nss_getline (line=0x7ffff5a004a0 "passwd:         compat systemd") at ../include/ctype.h:41
#1  nss_parse_file (fname=0x7ffff4cc75b7 "/etc/nsswitch.conf") at nsswitch.c:584
#2  __GI___nss_database_lookup2 ([email protected]=0x7ffff7f9904f "passwd_compat", [email protected]=0x0, 
    [email protected]=0x7ffff7f99000 "nis", [email protected]=0x7ffff7f9b390 <ni>) at nsswitch.c:127
#3  0x00007ffff7f93740 in init_nss_interface () at nss_compat/compat-pwd.c:94
#4  0x00007ffff7f956b5 in _nss_compat_getpwuid_r (uid=1000, pwd=0x48d9560, buffer=0x48ee8d0 "\250\061\215\004", buflen=1024, errnop=0x48db848)
    at nss_compat/compat-pwd.c:1064
#5  0x000000000221dcda in getpwuid_r ()
#6  0x000000000221dab4 in getpwuid ()
#7  0x000000000095e5f2 in ?? ()
...
Thanks!

borkdude07:12:38

What bb binary did you download?

borkdude09:12:34

Perhaps the static compiled one? Don't use it if you don't have to

crimeminister01:12:12

It likely was the statically compiled one, I'll try again otherwise and see what happens. Thanks for the suggestion!

slipset17:12:44

For Reasons(TM) I wanted to have bb be part of my circle ci environment. Of course, I’m stuck on how to install bb in circle. Yes, it’s most likely me, but any help on how to make bb available during my circle jobs would be really appreciated.

slipset17:12:17

The bash wget thingy fails with a missing filedescriptor.

lukasz17:12:40

Not using bb in circle, but we just straight up curl -L via GH release urls

slipset17:12:08

Thanks! that worked.

slipset17:12:25

- run:
         name: Install babashka
         command: |
            curl -L --output bb.zip 
            unzip bb.zip
            chmod a+x bb

slipset17:12:42

Please don’t get me started on how much I love yaml…

lukasz17:12:47

Yep,also you can leverage Circle's cache and not download the file on each run

borkdude18:12:25

@slipset babashka also has an install script: https://raw.githubusercontent.com/borkdude/babashka/master/install It supports a --version argument if you want to lock the version

borkdude18:12:49

but curl and unzip is fine too

borkdude18:12:58

and btw, you can generate the yaml from edn with babashka too ;)

slipset18:12:58

That’s what I tried first, but it failed on circle. Maybe /tmp is not available on circle?

lukasz18:12:18

each run is in a separate container I believe, and only cached storage is shared

lukasz18:12:57

sorry - I need to clarify, you can write to tmp, but you also instruct circle to persist paths in cache and restore it

lukasz18:12:01

it's a bit fiddly to be honest

lukasz18:12:50

here's how we're caching maven deps: https://github.com/nomnom-insights/nomnom.bunnicula/blob/master/.circleci/config.yml#L23-L35 - similar mechanism works for anything

borkdude18:12:26

@slipset I now added the --download-dir option to the script: https://raw.githubusercontent.com/borkdude/babashka/master/install E.g.:

./install --dir . --version 0.2.5 --download-dir . 
should work

slipset18:12:27

And 🙂

#!/bin/bash -eo pipefail
bash <(curl -s ) --dir . --download-dir .
Downloading  to .
Successfully installed bb in ..
CircleCI received exit code 0

🎉 3
slipset18:12:36

Thanks for the quick turnaround!

lukasz19:12:09

@slipset ha, we have exactly the same script in bash because Circle cannot do conditional step runs