View Issue Details

IDProjectCategoryView StatusLast Update
0000149Kolibri OS (trunk)Applicationspublic2024-02-23 16:57
Reporterfloppy121 Assigned Tohidnplayr  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAny x86 / Любой x86OSKolibriOSOS VersionSVN autobuilds
Product VersionSVN build / автосборка SVN 
Fixed in VersionSVN build / автосборка SVN 
Summary0000149: IRCC becomes unstable with 0.34 version (r9091 --> r9092)
DescriptionI'm trying to connect IRCC to my self-hosted-on-Windows-7 InspIRCd server:

https://github.com/inspircd/inspircd/releases/tag/v3.5.0 - InspIRCd-3.5.0.exe
with the following "inspircd.conf" differences:

<server
name="penguin.omega.example.org" ===> name="127.0.0.1"
<bind
port="6697" ===> port="6667"
<connect
localmax="3" ===> localmax="10"
globalmax="3" ===> globalmax="10"

1) Older IRCC 0.33 at r9091 floppy - connects to this server successfully,
can join a #test channel and successfully send some messages.

2) Updated IRCC 0.34 at r9092 floppy - always freezes while trying to connect!

To save time, you can launch these floppies with VirtualBox to reproduce the error:
r9091 - http://builds.kolibrios.org/eng/history/svn9091-img.7z
r9092 - http://builds.kolibrios.org/eng/history/svn9092-img.7z

Please note that this freezing problem somehow depends on a chosen server
or its' output: while IRCC 0.34 always fails with my own server, sometimes it could connect to irc.libera.chat successfully. However, even a successful connection won't last a long time: after joining a #linux channel and using it for a few minutes (or just being there for a while), it also freezes.
TagsNo tags attached.
SVN revision / ревизия SVNr9092
Type of distribution / Тип дистрибутиваimg / образ дискеты

Activities

floppy121

2022-01-28 14:50

developer   ~0000229

Reposting some of our PM exchange with hidnplayr:

> Could you check if code from 0.33 recompiled with serverparser.inc from 0.34 works or not?

Yes, indeed [b]textbox.inc[/b] is causing this issue. If it's r9092 version, then trying to connect to a server - results in an endless loop.
I already did some analysis, hope this will help to resolve the issue.

[b]Manual tracing how-to:[/b][spoiler]I placed "int 3" below no_colors. Since this gets triggered each time I try to click / control a program,
also had to enable the auto-connection to my server by these changes at ircc.asm [i](ENTER auto-click)[/i] :[code]mainloop:
...
cmp al , 3
je main_window_key ;;; (old was "je mouse")
...
[/code][code]main_window_key:
...
;;; cmp ah, 13 ; enter ;;; (commented out)
;;; jne no_send2 ;;; (commented out)
...[/code][/spoiler][b]Endless loop's body:[/b]
[spoiler][b]Register values - are equal to this at the beginning of each loop iteration:[/b]
[code]
| EAX = 0000 0004 | EBX = 0032 0012 | ECX = 3000 0000 | EDX = 0000 89E9 ___| ESI = 0000 0000 | EDI = 0000 4CAB |
| EBP = 0000 4CAB | ESP = 0000 6C3B | EIP = 0000 20AE | EFLAGS = 0000 1297 |[/code]draw_channel_text.no_colors:[code]
push edx
==> ESP = 0000 6C37
xor esi, esi
==> ESI = 0000 0000
dec esi
==> ESI = FFFF FFFF[/code]draw_channel_text.next_char:[code]
inc esi
==> ESI = 0000 0000
cmp esi, [textbox_width]
jz draw_channel_text.cnt_done
==> nothing happened
mov al, [edx]
==> EAX = 0000 0002
cmp al, 0Dh
jbe draw_channel_text.cnt_done
==> jumping to[/code]draw_channel_text.cnt_done:[code]
mov eax, edx
==> EAX = 0000 89E9
pop edx
==> EDX = 0000 89E9
push eax
mov EAX, 4
==> EAX = 0000 0004
int 40h
pop edx
==> EDX = 0000 89E9
cmp esi, [textbox_width]
jz draw_channel_text.line_full
==> nothing happened
imul esi, esi, 80000h
==> ESI = 0000 0000 (no change)
add ebx, esi
==> EBX = 0032 0012
jmp draw_channel_text.line
==> jumping to[/code]draw_channel_text.line:[code]
cmp byte [edx], 0
jz draw_channel_text.end_of_text
cmp byte [edx], 0Dh
jz draw_channel_text.newline_soft
cmp byte [edx], 0Ah
jz draw_channel_text.newline_hard
cmp byte [edx], 3
jnz draw_channel_text.no_colors[/code][/spoiler] As you see there are two push and two pop, and so the reg values stay the same between the cycles.

Below are the screenshots of chat windows. Initially I thought that maybe it's somehow connected to scrollbar which appears after more stuff is printed, but it happens even with IRCC windows max enlarged to avoid a scrollbar.

[b]HexChat:[/b] - https://i.imgur.com/fTIsLfe.png
[b]IRCC r9091:[/b] - https://i.imgur.com/iiSH6r1.png
[b]IRCC r9092:[/b] - https://i.imgur.com/gVO4zxr.png

It may be wrong, but maybe IRCC r9092 fails while trying to print the motd [i](message-of-the-day)[/i]. This would explain why for some servers a connection initially may work - although fails at the later point of time, - while for this InspIRCd it fails instantly. Here's a copy-paste of InspIRCd's motd: [url=https://pastebin.com/qTWSnuiz]https://pastebin.com/qTWSnuiz[/url] . It may be failing at this line with many escape characters:
[code]
       V \ \bWELCOME TO AN \c13I\c04N\c07S\c08P\c03I\c10R\c12C\c06D\c99 NETWORK\x
[/code] I can't debug further with different messages because my IRC server broke and I'm unable to fix it at the moment :mrgreen:

[b]P.S.[/b] By the way, I noticed that on startup - IRCC prints the welcome message and ASCII art, but then almost instantly erases it and draws exactly the same stuff again, which seems a bit inefficient

floppy121

2022-01-28 14:52

developer   ~0000230

I investigated this problem further:

The escape characters from InspIRCd "message-of-the-day" [i](motd)[/i] are translated by it into special ASCII codes
the same way as described at this wiki - [b][url=https://defs.ircdocs.horse/info/formatting.html]https://defs.ircdocs.horse/info/formatting.html[/url][/b]

Although IRCC seems to support colors [i](seeing them working, and according to [b][url=http://websvn.kolibrios.org/filedetails.php?repname=Kolibri+OS&path=%2Fprograms%2Fnetwork%2Fircc%2Ftextbox.inc]textbox.inc[/url][/b])[/i],
it does not support some basic text formatting like [code]\b ==> ASCII 0x02 , for bold text until 0x0F code
\i ==> ASCII 0x1D , for italics text until 0x0F code
\u ==> ASCII 0x1F , for underlined text until 0x0F code[/code] - instead, it tries to print these special chars AS-IS on the textbox window.

Printing 0x1D and 0x1F doesn't break IRCC - they are displayed as some weird chars: "not equal" sign and "centered dot" respectively.
However, there is a problem with "bold" 0x02 char: trying to print it results in a IRCC crash upon the refresh of IRCC window.

What's interesting: as you could see by my [url=https://board.kolibrios.org/viewtopic.php?f=2&t=3727&hilit=ircc+ascii#p70823][b]1st message here[/b][/url], at 2018 version of KolibriOS (~r7300),
0x02 char was printable as a "vertical rectangular chessboard". Meanwhile, at a newer KolibriOS (~r9091)
it stopped being printable but at least doesn't crash IRCC 0.33 - unlike 0.34 from r9092.
As for 0x03, maybe it was crashing 2 years ago because I didn't follow it with a color code.

Possible solutions:
[list][*] worse - simply skip printing these special characters so they don't do anything
[*] better - extend the text formatting support, seeing the colors are already implemented[/list]

[b]P.S.[/b] I also tried another chat server - UnrealIRCd, and noticed the IRCC "ping-pong" bug:
[b][url=http://bugs.kolibrios.org/view.php?id=150]http://bugs.kolibrios.org/view.php?id=150[/url][/b]
Although [b]cmd_ping[/b] [url=http://websvn.kolibrios.org/filedetails.php?repname=Kolibri+OS&path=%2Fprograms%2Fnetwork%2Fircc%2Fserverparser.inc]is implemented at serverparser.inc[/url], it didn't work for some reason

floppy121

2024-02-17 14:50

developer   ~0000250

As a small reminder: IRCC freezes when trying to print the unsupported characters such as BOLD code 0x02, which could be i.e. a part of MOTD ("Message of the Day") that is sent to you by IRC server when you join it. I investigated this further, IRCC freezes when receiving any of these chars (decimal codes) :

1 , 2 , 4 , 5 , 6 , 7 , 8 , 9 , 11 , 12

As a temporary solution, I came up with this patch (see the attached file, could be merged with "patch -p1 < ./kolibrios_r9976_ircc-fix-chars.patch" command on Linux) - to ensure that IRC does not try to print any of these "bad characters". Please review and merge it to KolibriOS SVN
kolibrios_r9976_ircc-fix-chars.patch (1,210 bytes)   
---
 programs/network/ircc/textbox.inc | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/programs/network/ircc/textbox.inc b/programs/network/ircc/textbox.inc
index c7c47041..7649919e 100644
--- a/programs/network/ircc/textbox.inc
+++ b/programs/network/ircc/textbox.inc
@@ -140,6 +140,30 @@ print_asciiz:
 ;----------------------------------
 print_char:
 
+        cmp     al, 1
+        je      .unsupported_char
+        cmp     al, 2
+        je      .unsupported_char
+        cmp     al, 4
+        je      .unsupported_char
+        cmp     al, 5
+        je      .unsupported_char
+        cmp     al, 6
+        je      .unsupported_char
+        cmp     al, 7
+        je      .unsupported_char
+        cmp     al, 8
+        je      .unsupported_char
+        cmp     al, 9
+        je      .unsupported_char
+        cmp     al, 11
+        je      .unsupported_char
+        cmp     al, 12
+        je      .unsupported_char
+        jmp     .supported_char
+   .unsupported_char:
+        ret
+   .supported_char:
         push    esi edi
         mov     esi, [window_print]
         mov     edi, [esi + window.text_write]
-- 
2.43.2

hidnplayr

2024-02-23 16:57

developer   ~0000251

Fixed in 9978

Issue History

Date Modified Username Field Change
2022-01-25 15:15 floppy121 New Issue
2022-01-28 14:42 floppy121 Assigned To => hidnplayr
2022-01-28 14:42 floppy121 Status new => assigned
2022-01-28 14:50 floppy121 Note Added: 0000229
2022-01-28 14:52 floppy121 Note Added: 0000230
2024-02-17 14:50 floppy121 Note Added: 0000250
2024-02-17 14:50 floppy121 File Added: kolibrios_r9976_ircc-fix-chars.patch
2024-02-23 16:57 hidnplayr Status assigned => resolved
2024-02-23 16:57 hidnplayr Resolution open => fixed
2024-02-23 16:57 hidnplayr Fixed in Version => SVN build / автосборка SVN
2024-02-23 16:57 hidnplayr Note Added: 0000251