***sajith_ is now known as nonzen
<johnjay>dsmith-work: i think i asked this before but is guix the package system for guile? <johnjay>i.e. the equivalent of melpa/apt/yum? <dsmith-work>Well, I guess it looks like it's becoming that. But guix is actually a system package thingy. (never used guix) <ardaukas>I'm just new to scheme and Guile, just starting to try it ... because I'd like them to be my primary coding langs <ardaukas>I hope that you can help me with some basic questions: <ardaukas>- best web/forum (kind of stackoverflow) to ask questions about scheme/guile? <ardaukas>- For my first network exercise I want to perform a DNS request to a specific name server, but can't find any library specific for DNS requests in Guile ... so I must be looking in the wrong place. Any suggestion for this use case? <dsmith-work>The mailing lists are archived, and recently, this chan is now logged. <ardaukas>I mean, I'd like to not make my "basic exercise" grow by having to implement it in C ;) <ardaukas>I've tried "getaddrinfo" ... but does not seem to give the IP addresses nor I find any way to convert it's answer into an A IP value, for example <catonano>ardaukas: I think you should get a connection to a dns server and then interrogate it in code you write yourself <catonano>and then maybe you could just print the result in the repl <catonano>as far as I can tell there are no libs for this but it shouldn't be very hard <catonano>there are examples of tiny servers and clients in the manual <ardaukas>there must be some lib, it's a basic network request <ardaukas>(addrinfo:canonname (car (getaddrinfo "www.gnu.org" #f AI_CANONNAME))) <catonano>I used a little utility called "nc" to inspect the network traffic my guile script was generating, as an aid <ardaukas>(guile-user)> (addrinfo:addr (car (getaddrinfo "www.gnu.org" #f AI_CANONNAME))) <ardaukas>... seems that could be a matter of converting that number to an IPv4 octet sequence? <dsmith-work>ardaukas: Do you want it printbale in dotted quad notation? <ardaukas>So it was there and just was missing the last step ?! <dsmith-work>Ya. getaddrinfo returns things that are nice to pass to connect <ardaukas>Juas! I had it there :) , just didn't think about "convert decimal to IP" <dsmith-work>So that #(...) is a vector with the adress, address family, (and something else). <ardaukas>first time I use it (well, everything, scheme, guile ...) just had guessed that should be the one <dsmith-work>Well, it's just a fairly thin wrapper over the C getaddrinfo <ardaukas>I've seen it's a scheme function in POSIX->networking <ardaukas>but guile complains saying it's an unbound variable <ardaukas>In the docs there's no reference saying that an import is needed <dsmith-work>scheme@(guile-user)> (addrinfo:addr (car (getaddrinfo "www.gnu.org"))) <dsmith-work>scheme@(guile-user)> (inet-ntop (sockaddr:fam $1) (sockaddr:addr $1)) <ardaukas>?? exiting and retrying ... now it works !?! <dsmith-work>Though I don't think you can use getaddrinfo to query a specific dns server. It just calls the local name resolver. <ardaukas>scheme@(guile-user)> (inet-ntoa 2130706433);;; <stdin>:5:0: warning: possibly unbound variable `inet-ntoa'ice-9/boot-9.scm:1669:16: In procedure raise-exception:Unbound variable: inet-ntoa <ardaukas>scheme@(guile-user)> (inet-ntoa 2130706433);;; <stdin>:5:0: warning: possibly unbound variable `inet-ntoa'ice-9/boot-9.scm:1669:16: In procedure raise-exception:Unbound variable: inet-ntoa <ardaukas>scheme@(guile-user)> (inet-ntoa 2130706433) <dsmith-work>And you have to pass in the family, because it also does ipv6 <ardaukas>yes, yes, but attending to Guile's doc, inet-ntoa should perform the conversion: <ardaukas>that line I've pasted is just an example from the doc <ardaukas>I was just about to tell you that the search engine had taken me to a wrong version :( <ardaukas>and I agree with you that seems that getaddrinfo asks to the local system, no way to send the request to the remote DNS server (as "dig" does) <dsmith-work>Yes, dig is a tool used specifcally for dns queries. getaddrinfo is for name resolution in general. (like it can use /etc/hosts or nfs or whatever is in nsswitch.conf. Well, suspect. Never tried..) <ardaukas>yes, seems so. Thanks a lot, I'll check how launch dig from guile <ardaukas>Thanks, you've been very helpful. Seems that there's nothing like GNU/Linux dig for scheme <ardaukas>I'm just building the master branch of guile 3.0.4 for Ubuntu <str1ngs>ardaukas: which variant of ubuntu are you using? <ardaukas>I've just checked /usr/bin/guile and it's 3.0.4 ! <ardaukas>curious, before I was lunching it from /usr/local/bin and was 3.0.1 ... there's something wrong <str1ngs>guile --version is 3.0.1 for me. using focal 20.04 <ardaukas>yesterday I downloaded the 3.0.4 tar.gz and built and installed it ... and installed a 3.0.1 guile REPL ?? <str1ngs>lsb_release -a Description: Ubuntu 20.04.1 LTS <str1ngs>ardaukas: did you install it with prefix /usr? <ardaukas>no, just configure, make, sudo make install I think <str1ngs>maybe use make uninstall to remove /usr/local . make sure you still have the same configure prefix <str1ngs>that's if you intend to use repo guile 3 <str1ngs>ardaukas: to remove the guile installed to /usr/local. bad wording on my part. <ardaukas>linked to /usr/local/bin/guile, which is 3.0.4.35... <ardaukas>and /usr/bin/guile launches 3.4.35... too <ardaukas>well, no problem, nevertheless, I'll try building the very latest version and deploy it to /usr/local <ardaukas>build fails. Tries to run "makeinfo" command, which is not found <ardaukas>so, dependencies on flex an texinfo so far <ardaukas>So, rebuilding now, thanks for your help :). I have to leave now, hope to be back soon <dsmith-work>Often, "apt-get build-dep" for a previous version will install the dev packages you need.