2025-02-18 00:53:30 crc: Well I think redraw() is the slow bit (although some lag is caused by waiting for KEYUP for input) 2025-02-18 00:53:44 But I too am struggling to sort out these performance issues 2025-02-18 00:54:08 I tried rewriting with SDL_Surface because that's supposedly better for pixel performance 2025-02-18 00:54:51 It seems like there's more than a couple issues with SDL's bitmap performance, and the docs aren't a lot of help trying to do the right thing 2025-02-18 00:55:22 Ironically 3D is really easy, but 2D pixel stuff is really slow 2025-02-18 00:56:39 It could be forced VSYNC, in which case redraw() might do better being limited to once a frame 2025-02-18 05:03:59 are you writing directly to memory with a pointer? 2025-02-18 05:04:26 I think I ended up using a texture for this. there are multiple ways to so it and a huge speed difference between them 2025-02-18 06:36:52 !gforth 1 1 + . 2025-02-18 06:36:52 2 2025-02-18 06:37:19 crc: I have made this simple bot, however it's still in work in progress 2025-02-18 06:37:31 It's just a illustration of how the bot will work 2025-02-18 06:38:00 you can play with the bot :) 2025-02-18 06:38:44 !gforth : SQUARE dup * ; 5 SQUARE . 2025-02-18 06:38:44 25 2025-02-18 06:38:53 !gforth : SQUARE dup * ; 10 SQUARE . 2025-02-18 06:38:54 100 2025-02-18 06:39:35 the bot is running inside a docker container 2025-02-18 08:50:52 MrMobius: If you've got any code for this somewhere and could dig it out it would be appreciated 2025-02-18 08:51:21 But I do suspect one issue is that redraw() which converts the VRAM into a surface or texture and then copies it to screen; is being called more often than it needs to be 2025-02-18 08:51:44 Once for every 'update', like every time a character is drawn, rather than once per display refresh 2025-02-18 08:53:28 And so there may be some unrequested vsync fuckery, or it could simply be a lot faster to just replace refresh() with refresh_next=1 and put refresh() in the main loop to only occur if (refresh_next && timer() > REFRESH_PERIOD) 2025-02-18 08:55:50 !gforth s" ls /" system 2025-02-18 08:55:50 bin 2025-02-18 08:55:56 !gforth bye 2025-02-18 08:56:03 !gforth 5 . 2025-02-18 08:56:04 5 2025-02-18 08:56:29 veltas: it's running inside docker container 2025-02-18 08:56:42 Yeah I saw that 2025-02-18 08:57:10 it's only priting the first line of the output 2025-02-18 08:57:15 I have to make some changes in the code 2025-02-18 08:57:33 the bot is currently in alpha, I just wanted people to experiment with it 2025-02-18 08:57:53 Is the network part running outside of docker? 2025-02-18 08:58:37 !gforth s" which gforth" system 2025-02-18 08:58:38 /usr/bin/gforth 2025-02-18 08:58:55 veltas: wait I forgot to disable internet access of the docker 2025-02-18 08:59:11 Might want to do that 2025-02-18 09:00:05 I'm not actually going to try and pwn you, but whenever someone puts a bot in IRC I will try and discover the issues with it because they quite often have huge security holes 2025-02-18 09:00:36 veltas: i am the most unhackable person on earth 2025-02-18 09:00:54 thanks to XEN lol 2025-02-18 09:05:49 !gforth s" ls / | fold -w" system 2025-02-18 09:12:13 What's unfortunate is that the VRAM for ilo-x is *almost* an SDL bitmap format, it's just going to require byteswapping because it's most-significant-bit and we can't assume a big endian platform 2025-02-18 09:12:40 But I don't think the byteswapping and blitting I'm doing slows it down much at all 2025-02-18 09:13:18 ACTION is back :) 2025-02-18 09:13:51 veltas: yes, my friend found a lot of issues with it and we fixed it 2025-02-18 09:13:57 Nice 2025-02-18 09:14:17 !gforth s" ls / | tr '\n' ''" system 2025-02-18 09:14:40 Are pipes just not allowed or am I bad at this 2025-02-18 09:14:41 !gforth s" ls " system 2025-02-18 09:15:04 tr: when not truncating set1, string2 must be non-empty 2025-02-18 09:15:04 Could be both 2025-02-18 09:15:11 Try 'fold --help' for more information. 2025-02-18 09:15:17 this is the error log I see 2025-02-18 09:15:21 !gforth s" ls / | tr '\n' ' '" system 2025-02-18 09:15:21 bi 2025-02-18 09:15:35 !gforth s" ls / | tr '\n' ' '" system 2025-02-18 09:15:36 bi 2025-02-18 09:15:40 :0 a forth bot 2025-02-18 09:15:51 !gforth ." :D" cr 2025-02-18 09:15:52 :D 2025-02-18 09:16:15 !gforth s" mount" system 2025-02-18 09:16:15 overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/4LWISPM42NNOCWYCC7IUF7ZYPY:/var/lib/docker/overlay2/l/XAVLZGBSSYTD6WFZY742GETCOZ:/var/lib/docker/overlay2/l/S2ZTY6O5GF6FT3UCBWZS3VQ44Z:/var/lib/docker/overlay2/l/WIBSR5UVBO4VZ4VNZV4YYZ3FG4:/var/lib/docker/overlay2/l/KSLMI4CNZO2BCOA3HPANSOQU63:/var/lib/docker/overlay2/l/LSEW6SGPU75NJXWBP7C3HT3NCS,upperdir=/var/lib/docker/overlay2/0a8c5a43adb 2025-02-18 09:16:31 oh it can flood 2025-02-18 09:16:44 vms14: no it only prints the first line of the output 2025-02-18 09:16:47 !gforth cr cr cr 2025-02-18 09:17:01 !gforth s" gforth" environment? [IF] type [THEN] 2025-02-18 09:17:02 0.7.3 2025-02-18 09:17:03 what if the first line is large 2025-02-18 09:17:26 Then it prints under 512 bytes 2025-02-18 09:17:38 It cut it off earlier 2025-02-18 09:17:38 then it's fine 2025-02-18 09:18:29 ghodawalaaman it's cool that you made this bot 2025-02-18 09:18:47 Thank you :3 2025-02-18 09:19:04 it will be handy when discussing anything about forth 2025-02-18 09:19:08 Yes it is great ghodawalaaman, this will be very useful if it stays up and doesn't get you hacked 2025-02-18 09:19:41 I'm afraid to try [BEGIN] ." asdf" [AGAIN] 2025-02-18 09:19:47 there is currently a vulnerability that let's you execute arbitary IRC command from the bot 2025-02-18 09:20:06 xn435: the command will timeout 2025-02-18 09:20:08 You might want to ask pragma in #c what he did to secure his compiler bots 2025-02-18 09:20:29 pragma is a perl dev 2025-02-18 09:20:31 !gforth ." /nickserv" 2025-02-18 09:20:31 /nickserv 2025-02-18 09:20:54 xn435: the second line will be executed as an IRC command 2025-02-18 09:21:02 don't do something malicious with it please 2025-02-18 09:21:06 !gforth cr ." /nickserv" 2025-02-18 09:21:09 veltas: I will ask him thank you! 2025-02-18 09:21:21 nah I don't intend to :) 2025-02-18 09:21:23 nice bot 2025-02-18 09:21:35 :3 2025-02-18 09:22:30 vms14: He's got it running GCC so it's definitely sandboxed 2025-02-18 09:22:44 And given what #c is like I'm assuming it's quite secure by now 2025-02-18 09:22:59 the perlbot is also sandboxed 2025-02-18 09:23:18 you cannot mess with it 2025-02-18 09:24:35 I made one for my toy lang once, but you could rm -rf my system xd 2025-02-18 09:25:41 didn't bother to prevent anything, but in my case I could remove harmful words 2025-02-18 09:27:54 ghodawalaaman I assume you made a restricted user for the bot 2025-02-18 09:28:45 right now I haven't, I have to fix a lot of issue/vulnerability yet, but thank you for the suggesting 2025-02-18 09:28:56 right now it's more like proof of concept type bot 2025-02-18 09:29:30 this channel is small so there is less chance that someone will mess with it 2025-02-18 09:29:50 but it can happen anyways and you should be aware 2025-02-18 09:30:55 for now you could try to fix the most dangerous problems until you learn how to improve it 2025-02-18 09:31:23 yeah, I will make it more usable and secure! 2025-02-18 09:31:29 if you make a user you can mess with the path env variable so it won't find the commands like ls 2025-02-18 09:31:38 hopefully till weekend I will have a good version of the bot 2025-02-18 09:31:43 still io is a problem 2025-02-18 09:32:32 vms14: changing path variable is a neat idea 2025-02-18 09:32:42 but if the user has no write permissions then it's fine 2025-02-18 09:33:02 yeah 2025-02-18 09:33:57 you can also redefine some forth words 2025-02-18 09:34:58 !gforth : system ." :D" cr ; 2025-02-18 09:35:28 !gforth s" unix/socket.fs" included 2048 BUFFER: buf s" example.com" 80 open-socket dup s\" GET /\r\n\r\n" rot write-socket 500 ms dup buf 2048 read-socket type close-socket 2025-02-18 09:35:29 !gforth s" ls" system 2025-02-18 09:35:50 oh forgot the bot was offline lol 2025-02-18 09:38:19 xn435: I forgot to disable interenet of the docker container 2025-02-18 09:39:04 internet* 2025-02-18 09:39:17 yeah that could be an issue 2025-02-18 09:39:22 vms14: I will connect it again after I fix the issues :) 2025-02-18 09:41:53 I'm wondering if creating a custom wordlist and limiting memory reads and writes would be enough to secure it 2025-02-18 09:42:21 that is, only allowing to write and read from specific ranges 2025-02-18 09:43:07 it also has to prevent infinite loops, like some kind of watcher that will kill the process after a timeout 2025-02-18 09:43:29 yeah he mentioned that it would time out 2025-02-18 09:43:56 but there is always someone smarter that finds a way 2025-02-18 09:54:32 I had considered doing a Forth VM specifically designed to be run as a sandbox, e.g. for IRC or whatever situation it needed to be safe 2025-02-18 09:54:44 You can adapt existing VM's, e.g. ilo, and make them safe 2025-02-18 09:55:01 ilo is already nearly there, it just needs memory bounds checking really 2025-02-18 09:55:21 So doing a sandboxed konilo bot would be quite easy 2025-02-18 09:56:23 But we need an ANS Forth, Forth 2012 etc because most of our questions are about classic/standard forths 2025-02-18 09:57:13 The other idea was to treat the VM like a sort of old mainframe, and allow people access to private storage as well as shared storage for communicating with each other 2025-02-18 09:57:19 And sharing programs in blocks 2025-02-18 09:57:55 People could define their own command aliases in blocks 2025-02-18 09:58:24 There's a ton of fun stuff that can be done here, we forget sometimes that the internet is quite fun 2025-02-18 10:01:41 ghodawalaaman: this is a must read for people who want to make their bot secure: https://irc-bot-science.clsr.net/ 2025-02-18 10:01:58 and on top of that there's securing the interpreter itself of course 2025-02-18 10:03:12 well that's mainly for parsing links 2025-02-18 10:07:35 but if it's going to output user-generated text, it may give you ideas of things to prevent (like certain chars) 2025-02-18 13:01:44 veltas: https://pastebin.com/RveGnqXD 2025-02-18 13:14:38 veltas: re: bounds checking; see http://forth.works/ilo-unix.c for a copy of ilo with this 2025-02-18 13:22:34 MrMobius: Try 4 is actually what crc was using, except for STREAMING option which I tried and it made no difference 2025-02-18 13:22:44 I wonder if there's a difference in drivers affecting things here 2025-02-18 13:24:45 Assuming try 4 is the source shown 2025-02-18 13:25:03 yes 2025-02-18 13:25:17 see line 27 2025-02-18 13:26:47 I'll try delaying to refresh rate tonight probably, with the streaming texture 2025-02-18 13:27:08 And if that works well enough I'll fix the input lag too 2025-02-18 13:27:19 Or anyone else is welcome to give it a go 2025-02-18 13:28:14 what's the issue? 2025-02-18 13:31:16 ilo-sdl is slow basically 2025-02-18 13:32:05 You can try building it and run, and stuff like `catalogue` prints very slowly 2025-02-18 13:33:03 pgimeno: Thank you for the link! 2025-02-18 15:22:57 I have added the bot again 2025-02-18 15:23:25 however It still has some vulnerability which I couldn't fix 2025-02-18 15:23:59 gforth_eval_bot will work fine unless someone actually trying to crash the bot 2025-02-18 15:24:19 !gforth 1 1 cr . cr . 2025-02-18 15:24:22 https://0x0.st/8beJ.txt 2025-02-18 15:24:28 !gforth 1 1 + 2025-02-18 15:24:49 !gforth 1 1 + 2025-02-18 15:25:26 !gforth 1 1 + . 2025-02-18 15:25:27 2 2025-02-18 15:25:40 !gforth 1 1 . cr . 2025-02-18 15:25:41 1 2025-02-18 15:25:43 https://0x0.st/8bey.txt 2025-02-18 15:25:51 It also have support for multiline output now 2025-02-18 15:26:50 s/have/has 2025-02-18 15:42:00 !gforth 42 EMIT 2025-02-18 15:42:00 * 2025-02-18 15:42:26 !gforth : tostar 42 emit ; tostar 2025-02-18 15:42:27 * 2025-02-18 15:42:39 !gforth tostar 2025-02-18 15:42:52 sorry 2025-02-18 15:43:15 dzho: it's ok, you can test it now :) 2025-02-18 15:43:51 !gforth tostar 2025-02-18 15:43:59 !gforth 1 1 + . 2025-02-18 15:44:14 !gforth : tostar 42 emit ; 91 emit tostar 2025-02-18 15:44:19 derp 2025-02-18 15:44:26 I don't know why it's disconnecting 2025-02-18 15:44:31 smh 2025-02-18 15:44:35 !gforth 91 emit 2025-02-18 15:44:35 [ 2025-02-18 15:44:50 !gforth 89 emit 2025-02-18 15:44:51 Y 2025-02-18 15:44:59 !gforth : tostar 42 emit ; 89 emit tostar 2025-02-18 15:45:00 Y* 2025-02-18 15:45:11 ok maybe I'm just picking horrible example characters 2025-02-18 16:21:20 !gforth : x 1000 0 DO I . LOOP ; x 2025-02-18 16:21:21 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2025-02-18 16:21:23 https://0x0.st/8b21.txt 2025-02-18 16:21:37 all the vulnerabilities are fixed now 2025-02-18 16:22:08 I will wait 1 day, if no bugs are discovered I will host it on my VPS 2025-02-18 16:30:53 !gforth : r recurse ; r 2025-02-18 16:30:53 *OS command line*:-1: Return stack overflow 2025-02-18 16:31:04 maybe I should print the error messages too 2025-02-18 16:31:04 that's the nice version.. now for the evil version 2025-02-18 16:31:11 : r rdrop recurse ; r 2025-02-18 16:31:18 !gforth : r rdrop recurse ; r 2025-02-18 16:32:29 user51: the bot is still fine 2025-02-18 16:32:57 !gforth : R dup * ; 1223 R 2025-02-18 16:33:07 ghodawalaaman: well done. :) 2025-02-18 16:33:21 !gforth : R dup * ; 1223 R . 2025-02-18 16:33:22 1495729 2025-02-18 16:33:26 !gforth rdrop 2025-02-18 16:33:55 the bot won't remeber any WORD definitions 2025-02-18 16:34:11 bot launches a new instance of gforth everytime 2025-02-18 16:35:40 "All the vulnerabilities are fixed now" bold claim lol 2025-02-18 16:35:52 Nice job ghodawalaaman 2025-02-18 16:37:00 ghodawalaaman: maybe it should accept PMs 2025-02-18 16:37:10 also, my final test 2025-02-18 16:37:18 !gforth words 2025-02-18 16:37:21 https://0x0.st/8b2g.txt 2025-02-18 16:38:11 !gforth : x 0 0 do i . loop ; x 2025-02-18 16:38:16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2025-02-18 16:38:19 https://0x0.st/8b2E.txt 2025-02-18 16:46:38 veltas: Thank you! 2025-02-18 16:47:13 user51: yeah, maybe but coding that is tricky 2025-02-18 21:32:17 Well, I got kind of revved up on the idea of a Forth processor again yesterday and today. Had a couple of thoughts about it that were new for me, and it perked my interest again. Been eyeing my Artix A7 kit. :-) 2025-02-18 22:07:09 crc: https://pastebin.com/raw/Luw4qYTc 2025-02-18 22:07:52 For whatever reason this patch has vastly improved performance for me, so hopefully that helps you too 2025-02-18 22:08:04 I changed to STREAMING in there but not sure if that even makes any difference 2025-02-18 22:09:21 Well it probably makes difference in certain scenarios, but I don't think that was the limiting factor 2025-02-18 22:49:09 If you just OR SDL_WINDOW_SHOWN with SDL_WINDOW_RESIZABLE then the window is resizable 2025-02-18 22:49:23 And just do_redraw=1 on any SDL_WINDOWEVENT 2025-02-18 22:49:49 So that it actually redraws if you unhide or resize the window 2025-02-18 22:50:00 veltas what are you doing with sdl? 2025-02-18 22:50:06 some app or a game 2025-02-18 22:50:51 What am I not doing with it 2025-02-18 22:50:51 :0 2025-02-18 22:51:10 I only played a bit with xlib, but it was very cool 2025-02-18 22:51:21 I made a charmander walking on the screen with xshape 2025-02-18 22:51:30 crc previously tried SDL and ran into performance issues which I think I've fixed (at least for me I have, I don't know if it will fix for him too) 2025-02-18 22:51:43 it was a non rectangular window changing it's shape with the frames of the sprite 2025-02-18 22:52:32 I wanted SDL because I wanted a resizable window, and didn't know how to do it for X 2025-02-18 22:55:40 X Is Applicable For Point-Of-Sale? 2025-02-18 22:55:43 ConfigureNotify events 2025-02-18 22:56:27 do you mean if it makes sense to make a point of sale app with xlib? 2025-02-18 22:56:31 I also like that SDL is cross platform 2025-02-18 22:56:34 if you mean that, then no 2025-02-18 22:56:50 No don't worry vms14, making a joke about xentrac's filename 2025-02-18 22:56:58 ah lol 2025-02-18 22:59:41 veltas: X is a f****** piece of s*** 2025-02-18 23:00:20 the funny thing is that wayland is not much better xd 2025-02-18 23:08:36 handling window resizing in X? there's 2 events, and one of them is definitely not the one you want 2025-02-18 23:09:55 the one you don't want is the one with "Resize" in its name, specifically "ResizeRequest" 2025-02-18 23:11:25 i *think* you want something like ConfigureNotify? 2025-02-18 23:11:54 Classic IRC, I said I don't want to use X, and everyone tells me how to use X 2025-02-18 23:12:07 Oh well at least I learned something about tech I never want to use 2025-02-18 23:13:11 Is that because ResizeRequest is the *request*, and the resize triggers a ConfigureNotify? And if you intercept the ResizeRequest then it never happens? 2025-02-18 23:14:47 This reminds me of win32. They're very similar, except win32 isn't always a network protocol 2025-02-18 23:24:01 that sounds right 2025-02-18 23:31:31 crc: Fixed keyboard/input issues as well https://pastebin.com/raw/yyf4guyW 2025-02-18 23:46:27 Okay and I've also stopped it from using 100% CPU all the time, and removed debug keyboard queue prints https://pastebin.com/raw/rZsHsYgR 2025-02-18 23:56:38 Looks like the X demo crashes so it probably still needs some stuff added 2025-02-18 23:57:13 #653 I mean