IRC channel logs

2023-06-14.log

back to list of logs

<Kolev>Has anybody replaced shell scripts with Guile?
<dalepsmith>There were several attempts at running scsh on Guile. https://scsh.net/ https://www.gnu.org/software/guile/manual/html_node/The-Scheme-shell-_0028scsh_0029.html
<dalepsmith>The regular old sh/bash seems to be a decent enough DSL for running commands.
<RhodiumToad>eh
<RhodiumToad>the main thing is that sh is available, and guile might not be
<Kolev>Most of what I do is shell scripting, so I'd like to start doing it in Guile to get my feet wet in Guile.
<flatwhatson>well you have everything you need for pipes & filesystem access, guile is capable in that area
<dthompson>guix uses guile for this purpose
<dthompson>and has a number of handy procedures for making it easier
<dthompson>guile has good posix support so it's just a matter of writing the kinds of abstractions that make your life easier
<old>I usually use a #!/bin/sh that exec guile on the script
<old>and all my projects scripts are now written in Guile
<old>that allow me to import command modules
<old>ofc, basic one line bash script are still relevant ..
<old>but anymore than that is better in Guile imo
<Kolev>old, nice.
<flatwhatson>i also like working in the repl, you can have the same iterative process that you do in a terminal, but dealing with actual data structures
<flatwhatson>broke: powershell woke: scheme repl
<dthompson>+1
<cow_2001>okay, i just call curl instead of (web client), and use guile-lib's praghtml to get an sxml. now i need to somehow figure out how to get stuff from it.
<sneek>Welcome back dalepsmith!
<RhodiumToad>cow_2001: sxpath? sxml-match?
<cow_2001>O_O
<cow_2001> https://www.gnu.org/software/guile/manual/html_node/SXPath.html and https://www.gnu.org/software/guile/manual/html_node/sxml_002dmatch.html then
<cow_2001>which one's better for the odd scraping?
<RhodiumToad>depends, I guess? what does the sxml look like and what do you want to extract?
<cow_2001>a nitter thread
<lloda>is it acceptable to truncate-print ((a b c) (x y z)) to "((a b…", that is without the parens, rather than bailing out with a "#"
<lloda>tbc truncated-print already matches parens in most cases. This is just about the cases where it prints "#"
<xiews>Kolev: https://github.com/PuellaeMagicae/unix-in-lisp/blob/master/TUTORIAL.org
<xiews>Is this what you want?
<cow_2001>aaaaa! (sxml->html (html->sxml html)) is not.. uh.. identity!
<cow_2001>(equal? html (sxml->html (html->sxml html))) failed here. something to do with melding "\n" "\t" into "\n\t" or vica versa
<cow_2001>inside guile-library's htmlprag
<spk121>Today I learned that, on Win32, Guile's spawned process tests hang because processes don't exit when their pipes are closed. There is no MinGW SIGPIPE. That explains a lot
<spk121>But there seems to be a lot of fake SIGPIPE in Gnulib. I just don't know why it isn't having the desired effect for Guile MinGW
<Kolev>xiews: It's not Guile. I think what I want is Gash. https://savannah.nongnu.org/projects/gash/
<rekado>I’m playing with Server Sent Events
<rekado>my Guile web server responds to a GET request with a slowly produced stream of strings
<rekado>even though I’m using a procedure to write the response to the port it seems that the client waits for the response body to be fully generated
<dthompson>hmm I didn't know about this web api. neat!
<rekado>is this due to https://issues.guix.gnu.org/issue/21093?
<dthompson>ACTION is in the guile-gnutls mines, stumbling over a bunch of C code
<rekado>do I really need to replace the http server implementation, including http-write and run-server?
<rekado>reimplementing this all takes much too long. What good is the feature to provide a procedure for generating the body when it’s all turned into a bytevector anyway?
<dthompson>I haven't looked at the web server code in a long time...
<dthompson>don't remember much about the details
<dthompson>probably there are things that would have been done different had suspendable ports been a thing at the time?
<Kolev>daviid - How do I install G-Golf now? Same as before?
<Kolev>davidl, I don't want to have to use my messy procedure, if I can avoid it. https://bluehome.net/csh/2023/06/14/install-g-golf-on-fedora-38/
<daviid>Kolev, yes, pretty clean procedure, congrat for the notes - for the g-golf configure step, you dson't need GUILE=/usr/bin/guile, just ./configure --prefix=/usr ...
<Kolev>daviid, OK. Thanks.
<Kolev>configure: error: Package requirements (guile-lib-1.0 >= 0.2.5) were not met:
<daviid>Kolev: i'll let you find why, we did all this already ...
<Kolev>I did `sudo make install`.
<RhodiumToad>remember that pkgconfig needs to find guile-lib's .pc file
<RhodiumToad>either that file should be in whatever place pkgconfig looks, or you need to supply an environment variable to tell it where to look
<Kolev>RhodiumToad, I did `sudo make uninstall` and `sudo make install`. 😞️
<RhodiumToad>on what?
<Kolev>RhodiumToad, `guile-lib`.
<RhodiumToad>ok, and where did it install the .pc file?
<daviid>pkg-config --path guile-lib-1.0
<Kolev>No results.
<RhodiumToad>do it didn't find the .pc file
<Kolev>/usr/local/lib/pkgconfig/guile-lib-1.0.pc exists.
<RhodiumToad>s/do/so
<RhodiumToad>right, but that's not where pkg-config is looking
<RhodiumToad>I explained all this last time
<Kolev>I guess my notes were incomplete.
<Kolev>I guess I can just use the other laptop for this, where it is alr. installed.
<Kolev>I'll just use the other laptop.
<RhodiumToad>did you log the channel?
<Kolev>RhodiumToad, maybe I have it in backlog. What string should I search for?
<Kolev>Hm. Oh well.
<RhodiumToad>the simple fix is --prefix=/usr
<Kolev>I searched for "Gash Guile" and got a funny image in DuckDuckGo.
<daviid>Kolev: in your guile-lib steps, you forgot to pas the prefix
<daviid>Kolev: re read the log of this channel, we've been there already ..
<Kolev>Fixed.
<Kolev>Sorry.
<daviid>np! don't forget to update your notes ...
<Kolev>daviid, yeah, I've updated it.
<rekado>when streaming a response to the HTTP client, how can I prevent my pipe from being broken?
<RhodiumToad>on some OSes there's a socket option to turn off sigpipe from a socket
<RhodiumToad>otherwise you can block sigpipe around writes
<RhodiumToad>or ignore it for the whole process
<civodul>rekado: (sigaction SIGPIPE SIG_IGN)?
<rekado>I really don’t know what I’m doing. I’m no longer getting random Broken pipe errors after doing what guix publish does: duplicating the response port and configuring the client socket.
<rekado> https://git.savannah.gnu.org/cgit/guix.git/tree/guix/scripts/publish.scm#n690
<rekado>this is the resulting monstrosity: https://elephly.net/paste/1686776237.scm.html
<rekado>all it does is keep response bodies that are procedures untouched until http-write can evaluate them
<Kolev>Guile 3.0 is not loading my init file as descr. in <https://www.gnu.org/software/guile/manual/html_node/Init-File.html>.