beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
Iacob has quit [Ping timeout: 252 seconds]
Iacob has joined #picolisp
seninha has quit [Ping timeout: 255 seconds]
beneroth_ has quit [Read error: Connection reset by peer]
beneroth has joined #picolisp
Iacob has quit [Ping timeout: 268 seconds]
Iacob has joined #picolisp
Iacob has quit [Ping timeout: 245 seconds]
Iacob has joined #picolisp
<fbytez> What are some likely causes of "EOF Overrun"?
<abu[7]> Either a missing ")" (or "]"), or a non-closed string
<abu[7]> The error should show the line number of the offending expression
<abu[7]> If it is a string, Vip shows it as underlines
<taleon> I am new to PicoLisp. What is the most effective way of working? I haven't figured that out yet. My "way of working" still feels rather confusing. Start a terminal with `pil +`, then there (vi "foo.l"), then enter some code in the editor, then close with :w and :q, then load with (load "foo.l"), then execute the code and then start again from the beginning with (vi "foo.l"). I suppose it can all be done
<taleon> more simply and differently, without constantly closing, loading, etc.
<taleon> However, I haven't found that out yet, hence my question. :-)
<abu[7]> Closing and starting is not bad, as it usually starts within milliseconds
<abu[7]> I do both
<abu[7]> But mostly do (vi 'foo) inside the application
<abu[7]> or (vi "file.l")
<tankf33der> i am always inside micro editor.
<tankf33der> and call pil from it.
<abu[7]> Vip is better, because it has all knowledge about the running environment
<tankf33der> T
<abu[7]> Note that if you start Vip with (vi 'foo), you can suspend it with "qz", drop back into REPL, and resume with (v)
<taleon> I thought there would be a command directly from vip to switch to the repl and execute the code and vice versa, to simply transfer entries in the repl to the vip code.
<taleon> Ah thank you. This is exactly what I was looking for.
<abu[7]> yes, Ctrl-E on an expression
<taleon> Great :-)
<abu[7]> "E" for eval
<abu[7]> or ":l<enter>" to (re)load the whole file
<fbytez> I can't find any string or brace problems. Part of the "strangeness" is that's only occurring during the second accept/fork.
<abu[7]> So is it in the data being transmitted?
<fbytez> Is there anything wrong with this basic setup?: http://pb1n.de/?59f50d
<fbytez> The data is fine against another working implementation.
<fbytez> I feel like I'm missing something semantic about how pil forking and handling sockets.
<abu[7]> I think your code is correct
<abu[7]> EOF error happens only during 'read' (or 'load)
<fbytez> When I accept and fork from C, the same program but using stdin/out works.
<abu[7]> Do you call 'read'?
<fbytez> `in` and `rd`.
<abu[7]> 'rd' does not throw an EOF error iirc
<abu[7]> So it must be 'load'
<fbytez> The error is report at `(in *Peer` but only on a second accept/fork and it's not even the first use during that request.
<fbytez> Which implies the source file, right?
<abu[7]> Some garbage *after* the loop?
<abu[7]> after exited with 'T'
<abu[7]> You can do (bt) for backtrace at the error prompt
<abu[7]> and (trace 'load) to see within which load it fails
<fbytez> Does `(in *Peer ...` block?
<abu[7]> Yes
<abu[7]> Not 'in' but 'rd'
<abu[7]> (trace 'rd)
<taleon> I'm not sure what I'm doing wrong. When I open a repl (vi 'foo) in pil and suspend with `qz`, I can't get back to vip with `(w)`. Have I made a mistake and misunderstood the documentation?
<taleon> Ohman, I should put my glasses on. (v) and not (w) :-)
<taleon> Sorry for the noise. :-)
<abu[7]> No problem! Back to Vip is not (w) but (v)
<abu[7]> You can also see that Vip is still running with (stack) which shows running coroutines
<abu[7]> oops, I did not read all ;)
<fbytez> I'm apparently too dumb to see why this line is causing the problem: `(setq *WS_MAGIC_STRING "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")`
<abu[7]> This line looks good
<abu[7]> It has two double quotes, so the string is closed
<fbytez> It's the only thing I can change that creates/stops the problem.
<abu[7]> If you put that line into an empty file and 'load' it, does it give an error?
<fbytez> I actually can't test it that way, because the problem only surfaces combined with forking/accepting.
<fbytez> Even when the line is commented out, it still produces the error; only deletion solves it.
<abu[7]> Strange indeed
<abu[7]> Perhaps two processes are reading from the same file descriptor?
<abu[7]> Interferring with each other, each reading part of the stream
<fbytez> It's something about this string: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
<fbytez> Changing it to something else is fine.
<abu[7]> cause the length of the file contents change
<abu[7]> So the two processes see different stuff
<abu[7]> try to do strace -p -f <pid> before the fork
<abu[7]> : *Pid
<abu[7]> Then you see what the parent and child do, who is reading from where etc.
<fbytez> Can you see anything obvious in this?: http://pb1n.de/?2d9ebe
<abu[7]> Hmm, not really
<abu[7]> It must be a runtime problem
Iacob has quit [Remote host closed the connection]
<abu[7]> Statically, the file is OK
seninha has joined #picolisp
<abu[7]> It must be the dynamic order the I/O buffer is read by loading the rest of the file in the child
<abu[7]> Back later
<tankf33der> fbytez: is it linux?
<fbytez> tankf33der, Yes: Linux 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
<tankf33der> ok
<fbytez> I did a git pull and make a couple of hours too.
<fbytez> *hours ago
<tankf33der> from github?
<fbytez> Yep.
<tankf33der> you can check by function (version) in repl
<fbytez> 23.12.25
<tankf33der> fresh
<tankf33der> ok
<abu[7]> I'm walking in the snow, but I think I know what the problem is
<abu[7]> The string or expression is across the border of a BUFSIZ block
<abu[7]> The parent reads the first block while 'load'ing it
<abu[7]> the child inherits FD and buffers
<abu[7]> continues to read
<abu[7]> I never 'fork'ed while inside a 'load'ed file
<abu[7]> Not sure what exactly happens with the FDs and buffers
<abu[7]> (cold fingers, must run)
<fbytez> I might have to give up on pil; it feels like building on sand.
<tankf33der> fbytez: it is ok, just low level programming.
<abu[7]> This is not a Pil problem
<abu[7]> But what fork() means in POSIX
<abu[7]> how file descs and i/o buffers are inherited
<tankf33der> of course this is not pil's problem
<fbytez> It's nothing to do with low-level. I vomited out a c implementation without issue.
<abu[7]> C does not compile the file while you fork :)
<tankf33der> :)
<abu[7]> Look at @lib/http.l (you probably did)
<abu[7]> All functions are in memory when fork is called
<fbytez> Thanks. I'll put all the "functionality into functions".
<abu[7]> I'm not sure about my buffer theory. At least this works fine: http://pb1n.de/?5bffed
<fbytez> Are you in Germany? We're expecting snow in Switzerland today; haven't seen it yet.
<abu[7]> gives expected output
<abu[7]> i.e. the child continues in the buffer of the parent
<abu[7]> Perhaps it is not big enough, less thandBUFSIZ, but your code is also not so big
<abu[7]> No idea :)
<fbytez> I think with mine, it's a lot to do with the loop at the end.
<abu[7]> The loop will be completely read into memory
<abu[7]> The question is *who* starts reading somewhere in the middle
<fbytez> Yeah, which is why I only get the problem on forks after the first.
<abu[7]> I see, the second child
<abu[7]> But the second child inherits the buffer from the parent, not from the first child
<fbytez> Yeah, but that is true for both children, right?
<abu[7]> yes
<abu[7]> and the parent's buffer is not modified
<abu[7]> Here it works fine also with 2 children: http://pb1n.de/?5e7b86
<abu[7]> Both start from 1
<abu[7]> I try to run your code when I'm back home
<fbytez> Righto. Fine with everything in functions.
<abu[7]> Interesting
<abu[7]> Now I'm back. I tried your pasted code, and it works
<abu[7]> I went with w3m http://localhost:8888 twice
<abu[7]> Gives an empty page, but no errors
<abu[7]> The server echoes header data to stdout though, looks wrong to me
<fbytez> That's all expected for testing.
<abu[7]> ok
<fbytez> The test with w3m isn't sufficient because it terminates early.
<abu[7]> then curl?
<fbytez> https://danielfrost.org/share/jbxS/ — you can use these files in a command like: cat headers.txt payload-test.bin payload-seq-100.bin | nc localhost 8888 | hexdump -C
<abu[7]> No, I don't want to start an involved setup, sorry
<fbytez> Not a problem. I thought you wanted to see the issue for yourself.
<abu[7]> Yes, but not with too much effort ;)
<taleon> Quick question about vip: I use CTRL-E to evaluate the current S-expression after the cursor. Is it possible to evaluate the entire vip buffer, i.e. the whole file? Or is this only possible with a new (load 'foo.l)?
<taleon> Ah, `:l` does that. It saves, loads and evaluates the buffer at the same time. Very good. :-)
<abu[7]> yes, ":l" :)
<abu[7]> Sorry fbytez, I'm on Android here, and it seems it cannot play OGG files
<fbytez> Oh, I thought it would play in the browser.
<abu[7]> I tried that first, then downloaded with curl
<fbytez> It's OK in VLC and Firefox.
<taleon> fbytez: ffmpeg -i screencast-IHrm.ogg -vcodec libx264 screencast-IHrm.mp4
<taleon> This should convert the video.
<abu[7]> Good, let me try!
<abu[7]> hmm
<abu[7]> It produced an mp4, but still gives an error when I try to play it
<abu[7]> Let's forget this, I cannot invest so much time now
<fbytez> Can try this one, if you want: https://danielfrost.org/share/uoMX/caLB.mp4
<taleon> corrupt in firefox
<abu[7]> Same. It says that it cannot play the video
Iacob has joined #picolisp
<fbytez> Oh yeah, weird.
<abu[7]> OK, this works
<fbytez> 👍
<abu[7]> The error is in line 100
<abu[7]> but I have no clue
<abu[7]> As I said, your code looks good
<taleon> I have another question about vip: keyword "persistent mark". With `:m` you set a mark. What can I do with it? How can I use these marks? I haven't found anything further about it.
<abu[7]> The mark is stored in a file with that name and thus survives restart of Vip
<abu[7]> I used it as bookmarks when reading e-books
Iacob has quit [Quit: IRCNow and Forever!]
<taleon> Oh, that's interesting. Thank you very much. :-)
Iacob has joined #picolisp
<abu[7]> I exported some e-books with calibre to text and read them in Vip ;)
<abu[7]> Has some advantages like easier navigation and most of all searching
<abu[7]> The point is that if you set a mark once, Vip tracks and updates it, so you don't have to set it again when you quit the buffer
<taleon> The mark file is defined with `:m foo` and saved after exiting vip, right? Only two numbers are stored there. How are these assigned to the file? Or should the mark file be named accordingly? `foo.l` and the mark file `foo.mrk` as an example? If I then open the mark file I can see the two numbers and can jump to this position manually?
<taleon> The procedure for working with it is not yet entirely clear to me.
<abu[7]> Yes, saved when exiting. You can take any string, it is a file name
<abu[7]> If you read Book1.txt, you say :m book1
<abu[7]> I usually just use :m a
<abu[7]> as there is only one current book usually
<abu[7]> The first number is the column, the second the line
<abu[7]> So there is no hard connection between the file and the mark. Just in your head.
<taleon> Ok, now it's clearer for me. thanks for the detailed explanation. i can do something with it. now i know where i was last with the cursor and can continue reading at this point using the line number in the mark file. That makes sense.
<taleon> Sometimes the simple things are the most effective.
<abu[7]> yeah :)
<abu[7]> Simple concepts
<taleon> I also find the bakup function with `:bak` ingenious. I used to do this before with `cp foo.l{,.bak}`.
<taleon> Little by little I'm realizing how sophisticated vip is and how well you can work with it.
<abu[7]> Glad to hear this :)
<abu[7]> The concept of "marks" in Vip are perhaps confusing, because there are also the normal marks as in Vi[m]
<abu[7]> a-z and A-Z iirc
<abu[7]> The latter marks are in edit command mode, while :m is in the command window
<abu[7]> (just for the records here)
<taleon> I haven't even discovered the normal marks yet. :-) Thank you for pointing this out.
<abu[7]> I use "e" most often as it is the easiest to type in Penti
<taleon> How can I imagine that? I can set marks at different places in the current buffer and then jump back and forth between them?
<abu[7]> Yes, exactly
<taleon> Or do they work across several buffers?
<abu[7]> or do any edit operation on it
<taleon> Ah very great.
<abu[7]> Go to some place and hit me
<abu[7]> then from another place d'e
<abu[7]> this deletes (cuts) up to the place of e
<abu[7]> or y'e yanks the text etc.
<taleon> Oh, very interesting. That's really good to know.
<abu[7]> As always in Vi, you can combine any movements with editing commands
<abu[7]> d2fx finds the second "x" in the line and delets all up to it
<abu[7]> This is the feature which makes VI to the most powerful editor
<abu[7]> Most people don't know it
<abu[7]> They remember cw to change a word
<abu[7]> But "w" is a movement command
<taleon> Yes exactly
<abu[7]> combiner with "c" for change
<abu[7]> So you can do c'e to change until mark e
<abu[7]> or cG to change until the end of the file
<taleon> Good to know. I already knew about cG but not yet about c'e. Learned something new again. :-)
<abu[7]> You see all these editing commands with (vi 'vip~move)
<taleon> mark set for later reading.
<abu[7]> Perfect :)
<taleon> I'm offline again for a while. I learned a lot today. Thanks for your excellent support. You have probably already answered these questions 100x. :-)
<abu[7]> In fact not so much. Most people don't dive so deep into Vip
<aw-> hi abu[7], you should definitely get VLC for android