IRC channel logs

2023-03-13.log

back to list of logs

<mirai>old: its the http server that misbehaves :)
<mirai>occasionally it just stops answering to API requests
<mirai>the host is up
<mirai>rekado: I was looking at them
<mirai>I was wondering why is guile (web client) not reusing the guix open-socket-for-uri implementation
<ArneBab>civodul: did you see my email about separating the merge of srfi-119/wisp from changing language handling (because the discussion about the latter got out of hand — as somehow expected)? There’s a wip-branch for language handling, but I think srfi-119/wisp is ready without that.
<RavenJoad>Before I make a silly decision, does it make sense to build a parser for BibTeX and BibLaTeX files using the (ice-9 peg) module? Or should I use (system base lalr)?
<old>mirai: okay. Well the code I gave should be able to timeout on given http requests
<old>it's an unperfect solution but it should work for your use case I think
<mirai>old: silly question but where/how exactly do I set the timeout value?
<RavenJoad>Is there a convenient way to tag an already defined PEG class (namely peg-any) and remove a character from it? I am trying to match on a string of the form "{anything%can?go)here}", where anything is allowed between the { and }.
<flatwhatson>RavenJoad: anything except } can go there? "!}" or (not-followed-by "}")
<flatwhatson>string one should be "!'}'" sorry
<RavenJoad>flatwhatson: For now, yes. I think BibTeX allows you to escape when inside the { with a "\}" symbol, but I am ignoring that for now.
<RavenJoad>I'm doing the sexp route, so not-followed-by is probably what I want.
<flatwhatson>(and "{" (* (and (not-followed-by "}") peg-any)) "}")
<flatwhatson>RavenJoad: ^^
<flatwhatson>to support embedding \}, you can do this: (and "{" (* (or "\\}" (and (not-followed-by "}") peg-any))) "}")
<RavenJoad>flatwhatson: Thank you. After your initial not-followed-by hint, I got it. (and (ignore tag-value-delimiters) (* (and (not-followed-by tag-value-delimiters) peg-any)) (ignore tag-value-delimiters))
<RavenJoad>I tried your "\\}" one and the parser throws an error "invalid character in escape sequence: #\}". I am not too worried about it though. That escape symbol does not show up that much.
<flatwhatson>did you double-backslash, or single? single backslash gives that error, because "\}" is not an escape
<RavenJoad>I did double-backslash. The entire sequence was (and (ignore tag-value-delimiters) (* (or "\\}" (and (not-followed-by tag-value-delimiters) peg-any))) (ignore tag-value-delimiters))
<flatwhatson>hmm. what version of guile do you have?
<RavenJoad>(version) => $76 = "3.0.9" in Geiser.
<flatwhatson>oh, perhaps your input string to test with you put "\}" instead of "\\}"?
<flatwhatson>that double-slash is necessary to appease guile's string reader
<RavenJoad>That is what it was. The input string only had "\}", not "\\}" in it.
<RavenJoad>Is there a way to explore/find how to define certain characters? Like the - or _ characters.
<RavenJoad>Wait, I am just silly. I tested #\- in a REPL and it did not error out.
<flatwhatson>yes the repl is how to explore everything :)
<RavenJoad>I guess I was asking if there is a way to query/search for character representations.
<flatwhatson>characters are described in the manual: https://www.gnu.org/software/guile/manual/html_node/Characters.html
<flatwhatson>and string escapes are described here: https://www.gnu.org/software/guile/manual/html_node/String-Syntax.html
<kreyren2>I am writing a software specification.. What is the way in GNU Guile to get a list of available definitions? e.g. if i declare (define (kreyren) ...) to get a list of that
<kreyren2>ACTION figured out `(hash-map->list cons (struct-ref (current-module) 0))`, but ain't sure if that's the least stupid way
<kreyren2>actually
<kreyren2>hmmm
<kreyren2>ACTION goes to rework few things
<rekado>kreyren2: you can use module-map / module-for-each, which are a little more descriptive than using the hash-map->list thing.
<kreyren2>rekado: where do you get those? it's not returned from `info guile`
<rekado>they are in boot-9; they really should be mentioned in the manual but are not.
<rekado>(you don’t need to import anything to get these)
<kreyren2>ACTION goes to check source code for usage then
<kreyren2>(define (module-map proc module)
<kreyren2> (hash-map->list proc (module-obarray module)))
<kreyren2>oh
<kreyren2>ye the (module-map cons (current-module)) seems more clean thanks
<msavoritias>Is there any ui toolking besides gtk for guile? Thinking something like CLIM for Common Lisp
<kreyren2>there is a GTK for guile? :O
<msavoritias>that what i am wondering too ^^
<msavoritias>you can use gtk though g-golf but was wondering if there was something "native"
<old>mirai: `make-timeout-wrapper' takes a procedure a wrap it with a timer. it returns a procedure that takes two arguments and the rest of the arguments are given to the real procedure
<old>`(define http-get/timeout (make-timeout-wrapper http-get))'
<old>`(http-get/timeout 5 0 "http://example.com")' will timeout after 5 seconds
<old>`(http-get/timeout 0 50 "http://example.com")' will timeout after 50 micro-seconds
<mirai>Interesting, guile (web client) seems to be ipv4 only?
<mirai>http-get "http://localhost" gets conn refused for a server listening on ::1 (but not on 127.0.0.1)
<mirai>raw IPv6 address works though
<mirai>old: thanks
<old>mirai: Have a look at the definition of open-socket-for-uri. It's the procedure used for opening a socket
<mirai>what's the correct way to perform the equivalent of a >/dev/null for something launched with (system* ...) ?
<mirai>Is this supposed to cause a segfault in guile 3.0.9? > (spawn "uname" '("uname" "-a") #:output (%make-void-port "+"))
<mirai>it just segfaults left and right, no matter the make-void-port argument
<civodul>mirai: there's an embarrassing bug in spawn, that's fixed in "main"
<civodul> https://issues.guix.gnu.org/61073
<mirai>civodul: ah right, that explains it
<mirai>thanks
<mirai>am I dropping process privileges right? <https://paste.centos.org/view/04a4c7e1>
<civodul>mirai: there's also setgroups
<civodul>the Shepherd has examples of that
<mirai>civodul: thanks