IRC channel logs

2021-11-04.log

back to list of logs

<drakonis>hm
<drakonis>well, a little late for that
<drakonis>qwitwa: akku, guildhall, guix
<drakonis>guile definitely has loops through recursion i guess
<qwitwa>Is there a better repl than the default?
<qwitwa>Arrow keys don't seem to work
<drakonis>actually, yes.
<drakonis>you need to have guile-readline and guile-colorized installed for that
<drakonis>after that you need to configure your .guile file
<drakonis>let me look up the config file that guix uses
<drakonis> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/shadow.scm#n182
<drakonis>copy the contents of the next line minus quotes
<drakonis>and remove the unicode characters for new lines
<drakonis>also all the escape characters i guess
<dsmith>And for even more guile interactive enjoyment, there is geiser. (If you can handle emacs)
<qwitwa>I can handle emacs but I'd prefer to use vscode
<qwitwa>Doesn't seem like there's a language server
<dsmith>Nope
<qwitwa>where do I get guile-colorized from
<qwitwa>I don't see it in akku
<drakonis> https://gitlab.com/NalaGinrut/guile-colorized qwitwa
<qwitwa>Yeah, I found it eventually
<qwitwa>and manually moved it into the right place whilst cringing heavily
<flatwhatson>it's trivial with guix
<qwitwa>so long as you're not on window, right?
<qwitwa>*windows
<flatwhatson>i haven't tried it, but WSL might be a reasonable option
<qwitwa>Not if I'm shipping it inside a game
<flatwhatson>oh, like embedding a guile repl in the game itself?
<flatwhatson>that is cool, but yes, in that case WSL might not be an option
<flatwhatson>you could possibly use guix from WSL to prepare the library paths, and then run them with the win32 guile instead of WSL guile
<flatwhatson>that should work OK for anything that's purely scheme
<chrislck>if guile-3 on WSL works well then it would be amazing
<qwitwa>that sounds like such an awful package management bodge that it makes "fuck it, I'll rewrite akku in rust" look appealing
<drakonis>is this for writing tooling for a game or for modding?
<drakonis>also which game or it NDA'd?
<qwitwa>Personal project, been playing around with the sdl/opengl/imgui with the intended end goal of a roguelike
<qwitwa>So content description, touching on modding
<qwitwa>I do want to be able to handle logic
<daviid>qwitwa: if it is a personal project, you do not have nor need to target win, do you? fwiw - https://dthompson.us/projects/chickadee.html
<qwitwa>It's a personal project in the sense that I'm not being paid and am not under NDA
<qwitwa>that doesn't mean not being able to ship a working windows version is acceptable if I get anywhere worthwhile with it
<qwitwa>This seems like basic 101 stuff for the use-case I've seen guile advertised as
<qwitwa>I did see that library earlier, thought it looked cool
<qwitwa>I've worked on little love2d games before, seems like a similar interface
<qwitwa>in the end a combination of lack of static types and lua idiosyncrasies made it a bit less fun than it should have been
<qwitwa>and in this case there are some things I want to do that need easy direct opengl access
<qwitwa>but type safety was a big motivation for choosing c++
<qwitwa>If the call out to an extension language explode then that's fine, that entity gets shown as an error texture or whatever but the underlying system is unaffected
<lloda>fun
<lloda>(ash 1 (expt 2 64))
<lloda>In procedure bytevector-u32-native-set!: Argument 3 out of range: 4294967296
<lloda>(ash 1 (expt 2 63))
<lloda>Throw to key `numerical-overflow' with args `("ash" "Numerical overflow" #f #f)'.
<lloda>(ash 1 (expt 2 37))
<lloda>gmp: overflow in mpz type
<lloda>Aborted
<dsmith>Woah
<dsmith>sneek: botsnack
<sneek>:)
<lloda>i think we just need to be a lot more conservative throwing in there
<dsmith>Those really would be some huge numbers!
<lloda>i think it might be a 32/64 thing
<lloda>like long_max etc are ok limits on 32, but def not on 64
<dsmith>IIUC, it would take about 2,305,843,009,213,693,952 bytes to represent (ash 1 (expt 2 64))
<dsmith>What is that? Exabytes?
<lloda>2 exabytes
<dsmith>Yeah, I don't have quite that much ram.
<lloda>i'm inclined to use INT32_MIN etc
<lloda>(ash 1 (expt 2 30)) should fit in a GB or so but it takes such a long time, i doubt anyone would complain if it overflows
<manumanumanu>lloda: having fun? :)
<lloda>hmm :)
<lloda>review? http://git.savannah.gnu.org/gitweb/?p=guile.git;a=shortlog;h=refs/heads/wip-ash
<dadinn>hi all
<dadinn>I am trying to do some scripting by piping a password string into `passwd` call: https://termbin.com/o87k
<dadinn>it is described here that password\npassword string should be piped into passwd's stdin to do this: https://stackoverflow.com/questions/714915/using-the-passwd-command-from-within-a-shell-script
<RhodiumToad>passwd doesn't read the password from stdin, in a correct implementation
<dadinn>when i do it on the command line it indeed works like that, but for some reason my guile procedure is wrong, because when I try to login with the user, it complains that the password is incorrect
<dadinn>i've had similar issues with cryptsetup luksFormat/luksOpen , there it was that I used write-line, and the newline counted into the passphrase :/
<RhodiumToad>if your OS supports passwd --stdin then you need to use that
<RhodiumToad>without that, passwd reads from the tty
<dadinn>RhodiumToad: it's Debian, and I don't seem to have --stdin option
<RhodiumToad>then passwd is the wrong tool
<dadinn>RhodiumToad: `echo -e 'password\npassword' | passwd myuser` does work, and sets the password to 'password' :/
<RhodiumToad>well that's all kinds of broken
<drakonis>why are you passing a new line again?
<RhodiumToad>passwd reads the password twice
<drakonis>ah right
<drakonis>fair enough, carry on.
<dsmith-work>Morning Greetings, Guilers
<dadinn>drakonis: you mean in the cryptsetup or the passwd case?
<drakonis>passwd
<dadinn>I don't know where this echo password\npassword is coming from, I can't find any reference to it in the manuals
<dadinn>but it seems to work :/
<RhodiumToad>why would the passwd command read passwords from stdin? that's just nuts
<RhodiumToad>dadinn: try adding another (newline output-port) after the second display
<RhodiumToad>echo adds a newline
<dadinn>RhodiumToad: doesn't seem to work. Tried this too: (format output-port "~A\n~A\n" password password)
<RhodiumToad>specify "doesn't seem to work"
<RhodiumToad>did the password not get changed at all, or did it get changed to something else?
<RhodiumToad>have you tried getting the hashed value that was set and verifying it?
<dadinn>RhodiumToad: there is no error, but I am not able to log in with su, it throws an Authentication failure error
<dadinn>RhodiumToad: I mean there is no error when I am running the guile code, but then I am not able to log in. I assume the password is set to something other than expected.
<RhodiumToad>but using echo -e 'password\npassword' | passwd someuser on the _same_ user allows you to log in with su in the _same_ way?
<dadinn>yes it does
<RhodiumToad>use truss or strace or whatever to check that what got sent down the pipe was exactly what you expected
<dadinn> https://imgur.com/a/OdNtEyC
<dadinn>RhodiumToad: how do I do that?
<RhodiumToad>manpages are a thing that exist
<dadinn>No manual entry for strace or truss
<dsmith-work>dadinn: You might not have strace/truss installed. (strace for Linux, truss for *bsd)
<dadinn>RhodiumToad: strace confirms that 'password\npassword\n' gets written by "echo -o 'password\n\password'"
<dadinn>* echo -e
<RhodiumToad>right, but what gets written by your guile program
<dsmith-work>Do you need to supply the current password first?
<dadinn>RhodiumToad: interestingly the trace doesn't show any of that... I assume because the scripts forks and chroots halfway
<dadinn>* script
<RhodiumToad>see if there's an option to trace into child processes
<dsmith-work>There are options to strace to follow forks. But
<dsmith-work>maybe that doesn't allow suid progs?
<RhodiumToad>ah. that indeed is an issue
<dsmith-work>Ya, -f follows forks. -ff outputs each fork to a seprate file.
<RhodiumToad>do you have to do this suid?
<dadinn>RhodiumToad: the script has to be ran us root or with sudo
<dsmith-work>> Programs that use the setuid bit do not have effective user ID privileges while being traced.
<dadinn>RhodiumToad: but no suid afaik
<dadinn>RhodiumToad: running with -f I still don't see writing of the password anywhere. There are lots of EBADF bad file descriptor errors
<dadinn> maybe I should try creating a small example script which only does this one thing, without forking and all the rest.
<RhodiumToad>yes
<dadinn>not sure if this would cut it: https://termbin.com/wqmd
<dadinn>not good, one extra argument missing
<dadinn>#!/bin/sh
<dadinn># -*- scheme -*-
<dadinn>exec guile -e main -s "$0" "$@"
<dadinn>!#
<dadinn>(use-modules
<dadinn> ((ice-9 readline) #:select (readline))
<dadinn> ((ice-9 format) #:select (format))
<dadinn> ((ice-9 regex) #:prefix regex:)
<dadinn> ((ice-9 rdelim) #:prefix rdelim:)
<dadinn> ((ice-9 popen) #:prefix popen:))
<dadinn>(define* (set-password username #:optional password)
<dadinn> (format #t "Setting password for user ~A..." username)
<dadinn> (if password
<dadinn> (let ((output-port (popen:open-pipe* OPEN_WRITE "passwd" username)))
<dadinn> (format output-port "~A\n~A\n" password password)
<dadinn> (popen:close-pipe output-port))
<dadinn> (while (not (zero? (system* "passwd" username)))
<dadinn> (rdelim:write-line "Passwords don't match! Please try again!"))))
<dadinn>(define (main args)
<dadinn> (if (= 3 (length args))
<dadinn> (let ((username (cadr args))
<dadinn> (password (caddr args)))
<dadinn> (set-password username password))
<dadinn> (rdelim:write-line "Wrong number of arguments!")))
<dadinn>oops sorry
<dadinn> https://termbin.com/885gz
<dadinn> https://imgur.com/a/J6I1Str
<RhodiumToad>ok, and the password still didn't get correctly set?
<dadinn>RhodiumToad: it still didn't work :/
<RhodiumToad>that's quite strange
<RhodiumToad>does (printf 'password'; printf '\n'; printf 'password'; printf '\n') | passwd someuser work in the shell?
<dadinn>RhodiumToad: OTOH, this code works, with chpasswd: https://termbin.com/tduhu
<dsmith-work>dadinn: Just curious, what/why are you attemtping to change passwords?
<dadinn>dsmith-work: working on these scripts https://github.com/dadinn/debian-setup2/
<dadinn>dsmith-work: https://github.com/dadinn/system-setup/
<dadinn>dsmith-work: currently adding end-to-end testing using qemu, and was using (ice9 expect) to drive it, but it is becoming unmanageable, so I've added some unattended parameters to the scripts so that it doesn't need user interaction
<dadinn>the issue is that the installation works, but then I am not able to log in once rebooted, because the password is not set up correctly
<dadinn>btw it still doesn't work with the chpasswd version either. it works with the test script, but when I run the whole end-to-end test the login doesn't work again
<dadinn>not sure why :/
<dsmith-work>Yey Debian!
<dadinn>dsmith-work: Debian on ZFS root ;)
<dadinn>dsmith-work: the next submodule I will add is going to be called guix-setup ;)
<dadinn>dsmith-work: but I need to get the end-to-end tests working before I can start working on it.
<dsmith-work>Well, from the man page, chpasswd seems like the right thing to use.
<dsmith-work>Or maybe newusers ?
<lampilelo>can it be an encoding problem?
<dadinn>lampilelo: this works fine from the command line: https://termbin.com/e7sx
<dadinn>lampilelo: I mean sets the password and then you can su to the user, and it accepts the password. Interestingly when I try to log in after reboot, it doesn't work :/
<lampilelo>that is strange, does it modify /etc/shadow?
<dsmith-work>YEah, is it setting something in a chrooted environment instead of the real /etc/shadow ?
<dadinn>chrooted
<dadinn> https://github.com/dadinn/debian-setup2/blob/master/install.scm#L387
<lispmacs[work]>hi, if I'm reading from and writing to the same device file, do I have to use one "rw" port for that, or can I have one "r" port and one "w" port?
<lispmacs[work]>reasoning it through... so long as the device file supports multiple access, that shouldn't be a problem
<dsmith>lispmacs[work]: Watch out for buffering
<dsmith>lispmacs[work]: (force-output) to write the scheme port buffers to the fd.
<lispmacs[work]>I'm reading through the Guile Reference section on Non-blocking I/O, and it seems that the choice is between blocking i/o, or non-blocking i/o that is very slow
<lispmacs[work]>I'm a little confused... why isn't there just a way to poll a port to see if input is available?
<lispmacs[work]>ah, hmm, there is char-ready?
<lispmacs[work]>hidden in the "Venerable Interfaces" section
<lispmacs[work]>"on Linux kernels, all file ports
<lispmacs[work]> backed by files always poll as readable. For non-file ports, this
<lispmacs[work]> procedure always returns ‘#t’, except for soft ports"
<lispmacs[work]>logically, then, char-ready? would be useless unless using soft ports?
<lispmacs[work]>well, it doesn't say what happens for file port not backed by files. That would be special devices, yes?
<lispmacs[work]>and stdin/stdout?
<lispmacs[work]>if not backed by files