shmuz / far2m

Linux port of FAR2 with FAR3 macro system and extended plugins' API
GNU General Public License v2.0
27 stars 1 forks source link

far2m terminates itself unexpectedly after start #42

Closed sxored closed 1 year ago

sxored commented 1 year ago

version info

$ git log -3
commit ed4b214927ab546ddfc41a88ded3c69377731bba (HEAD -> master, origin/master, origin/HEAD)
Author: Shmuel Zeigerman <solomuz0@gmail.com>
Date:   Sun Sep 17 12:22:07 2023 +0300

    A special build with logging enabled (for PPA debugging)

commit 3bda361d20db0b8191e147aa3170ad3fcecd78cc
Author: Shmuel Zeigerman <solomuz0@gmail.com>
Date:   Sat Sep 16 16:27:44 2023 +0300

    LuaFAR API: export.ProcessEvent -> export.ProcessPanelEvent

commit acb37853cb55d2505377a327a26a8c8e536b0c74
Author: Shmuel Zeigerman <solomuz0@gmail.com>
Date:   Sat Sep 16 15:22:50 2023 +0300

    Refactoring

far2m built successfully

there is no error text after start in terminal

$ export FAR_STD=/tmp/farstd.log
$ export NETROCKS_VERBOSE=9

$ ./far2m --tty

$ tail -n 6 /tmp/farstd.log

FSNotify: watching 1 entries for '/home/user'
FSNotify: watching 1 entries for '/home/user'
CommandLine::ShowBackground: done
PANIC: unprotected error in call to Lua API (bad light userdata pointer)
PipeIPCError: PipeIPCRecver: read (11)
TTYX: PipeIPCRecver: read (11)
sxored commented 1 year ago
$ git log ... | tail -n 1
* 9b1af2ae - Add function win.ExpandEnv (8 weeks ago) <Shmuel Zeigerman>

far2m started as expected

FAR2M, version 2.5.0-9b1af2ae-beta Linux x86_64
Copyright (C) 1996-2000 Eugene Roshal, Copyright (C) 2000-2016 Far Group, Copyright (C) 2016-2023 Far People

While typing command:
 Ctrl+O - switch between panel/terminal.
 Ctrl+Up/+Down/+Left/+Right - adjust panels dimensions.
 Double Shift+TAB - bash-guided autocomplete.
 F3, F4, F8 - viewer/editor/clear terminal log (if panels are off).       
 Ctrl+Shift+MouseScrollUp - open autoclosing viewer with terminal log.    
While executing command:
 Ctrl+Shift+F3/+F4 - pause and open viewer/editor with console log.       
 Ctrl+Alt+C - terminate everything in this shell.
 Ctrl+Alt+Z - detach far2m application to background releasing terminal.  
 MouseScrollUp - pause and open autoclosing viewer with console log.      

/home/user$                                                                                                                                                                                                       ↑
1Left            2Right           3Name            4Extens          5Write           6Size            7Unsort          8Creatn          9Access          10Descr           11Owner           12Sort  
sxored commented 1 year ago

this build of far2m started as expected

FAR2M, version 2.5.0-fd8b1ba5-beta Linux x86_64
Copyright (C) 1996-2000 Eugene Roshal, Copyright (C) 2000-2016 Far Group, Copyright (C) 2016-2023 Far People

While typing command:
 Ctrl+O - switch between panel/terminal.
 Ctrl+Up/+Down/+Left/+Right - adjust panels dimensions.
 Double Shift+TAB - bash-guided autocomplete.
 F3, F4, F8 - viewer/editor/clear terminal log (if panels are off).       
 Ctrl+Shift+MouseScrollUp - open autoclosing viewer with terminal log.    
While executing command:
 Ctrl+Shift+F3/+F4 - pause and open viewer/editor with console log.       
 Ctrl+Alt+C - terminate everything in this shell.
 Ctrl+Alt+Z - detach far2m application to background releasing terminal.  
 MouseScrollUp - pause and open autoclosing viewer with console log.      

/home/user$                                                                                                                                                                                                       ↑
1Left            2Right           3Name            4Extens          5Write           6Size            7Unsort          8Creatn          9Access          10Descr           11Owner           12Sort  
shmuz commented 1 year ago

@sxored Thank you for the report. Unfortunately I can not reproduce the problem - the last github commit runs OK in Gnome terminal with --tty switch.

sxored commented 1 year ago

my test system info

----------
/etc/os-release:1:PRETTY_NAME="Debian GNU/Linux 10 (buster)"
/etc/os-release:2:NAME="Debian GNU/Linux"
/etc/os-release:3:VERSION_ID="10"
/etc/os-release:4:VERSION="10 (buster)"
/etc/os-release:5:VERSION_CODENAME=buster
/etc/os-release:6:ID=debian
/etc/os-release:7:HOME_URL="https://www.debian.org/"
/etc/os-release:8:SUPPORT_URL="https://www.debian.org/support"
/etc/os-release:9:BUG_REPORT_URL="https://bugs.debian.org/"
----------
/etc/debian_version:1:10.13
----------
sxored commented 1 year ago
$ gnome-terminal --version
# GNOME Terminal 3.30.2 using VTE 0.54.2 +GNUTLS
sxored commented 1 year ago
$ apt-cache policy liblua5.1-0-dev
liblua5.1-0-dev:
  Installed: 5.1.5-8.1+b2
  Candidate: 5.1.5-8.1+b2
  Version table:
 *** 5.1.5-8.1+b2 500
        500 https://deb.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status

$ apt-cache policy libluajit-5.1-dev
libluajit-5.1-dev:
  Installed: 2.1.0~beta3+dfsg-5.1
  Candidate: 2.1.0~beta3+dfsg-5.1
  Version table:
 *** 2.1.0~beta3+dfsg-5.1 500
        500 https://deb.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status
sxored commented 1 year ago

this far2m build works

af1646b8

$ git branch -avv
* (HEAD detached at af1646b8) af1646b8 Don't redraw listboxes when the parent dialog redraw is disabled\n(see Far3 build 4776)
shmuz commented 1 year ago

Here is my system:

$ cat /etc/issue
Linux Mint 21.2 Victoria \n \l

$ gnome-terminal --version
# GNOME Terminal 3.44.0 using VTE 0.68.0 +BIDI +GNUTLS +ICU +SYSTEMD

Tomorrow I will remove the logging (it was added temporarily to debug the PPA that should be available in a few hours). So please test the next commit when it is available.

sxored commented 1 year ago

diff debug logs

 FSNotify: watching 1 entries for '/home/user'
 FSNotify: watching 1 entries for '/home/user'
 CommandLine::ShowBackground: done
-PANIC: unprotected error in call to Lua API (bad light userdata pointer)
-PipeIPCError: PipeIPCRecver: read (11)
-TTYX: PipeIPCRecver: read (11)
+LoadPlugin: cache hit for '.../build/install/Plugins/luafar/luamacro/plug/luamacro.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/editorcomp/plug/editorcomp.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/editcase/plug/editcase.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/align/plug/align.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/calc/plug/calc.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/autowrap/plug/autowrap.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/drawline/plug/drawline.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/inside/plug/inside.far-plug-mb'
+LoadPlugin: cache miss for '.../build/install/Plugins/filecase/plug/filecase.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/NetRocks/plug/NetRocks.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/multiarc/plug/multiarc.far-plug-mb'
+LoadPlugin: cache miss for '.../build/install/Plugins/colorer/plug/colorer.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/tmppanel/plug/tmppanel.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/compare/plug/compare.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/incsrch/plug/incsrch.far-plug-wide'
+LoadPlugin: cache miss for '.../build/install/Plugins/SimpleIndent/plug/SimpleIndent.far-plug-wide'
+STARTUP: 46316
+ConsoleInput::Enqueue: # 0 58 2 DOWN
+ConsoleInput::Enqueue: # 0 58 2 UP
+ConsoleInput::Enqueue: # 0 27 100 DOWN
+ConsoleInput::Enqueue: # 0 27 100 UP
+ConsoleInput::Enqueue: # 0 d 0 DOWN
+ConsoleInput::Enqueue: # 0 d 0 UP
+CommandLine::ShowBackground: done
+ConsoleInput::Enqueue: # 0 4f 8 DOWN
+ConsoleInput::Enqueue: # 0 4f 8 UP
+CommandLine::ShowBackground: done
+ConsoleInput::Enqueue: # 0 4f 8 DOWN
+ConsoleInput::Enqueue: # 0 4f 8 UP
+ConsoleInput::Enqueue: # 0 58 2 DOWN
+ConsoleInput::Enqueue: # 0 58 2 UP
+ConsoleInput::Enqueue: # 0 d 0 DOWN
+ConsoleInput::Enqueue: # 0 d 0 UP
+FSNotify: watching 1 entries for '/home/user'
+FSNotify: watching 1 entries for '/home/user'
+CommandLine::ShowBackground: done
+SudoAskpassServer::Thread finished
sxored commented 1 year ago

this far2m build works too

67eaf7a0

$ git branch -avv
* (HEAD detached at 67eaf7a0) 67eaf7a0 Far API: extend struct PanelInfo with PluginID member
sxored commented 1 year ago

i should move forward at commits history not backward :)

sxored commented 1 year ago

current last commit 2023-09-17

https://github.com/shmuz/far2m/commit/ed4b214927ab546ddfc41a88ded3c69377731bba

23 commits ago from now - dc995974

$ git branch -avv
* (HEAD detached at dc995974) dc995974 Refactoring

far2m terminates after start

sxored commented 1 year ago

114 commits ago from now - 6956de9b

$ git log | ... -114 | tail -n 1
* 6956de9b - Fix the last commit (3 months ago) <Shmuel Zeigerman>

far2m started and works

shmuz commented 1 year ago

I'm appreciating your efforts! Is is failing only in TTY mode or in GUI (WX) mode too?

sxored commented 1 year ago

current date 2023-09-17

68 commits ago from now - 0d5fb346

$ git log | ... -68 | tail -n 1

far2m terminates after start

far2m debug log if started in WX mode ( without parameters in command line )

WinPortInitRegistry: OK 
WinPortFrame: display 0 from 0.53 area 0.0 - 1919.1079
Font 10 x 19 . 1: 'Monospace' - monospaced stable (integer)
OnInitialized: client size = 1920 x 1026
Current client size: 1920 1026 font 10 19
Changing size: 80 x 25 -> 192 x 54 
OnConsoleResized client size: 1920 1026
argv[0]='.../build/install/far2m' g_strFarModuleName='.../build/install/far2m' translation_prefix='' temp='/tmp/far2m_3e8_0/' config='/home/user/.config/far2m'
ExclusiveHotkeys::SetTriggerKeys: ctrl_left=0 ctrl_right=0 alt_left=0 alt_right=0 win_left=0 win_right=0
FSNotify: watching 1 entries for '/home/user'
FSNotify: watching 1 entries for '/home/user'
CommandLine::ShowBackground: done
*** Caught unhandled unknown exception; terminating
Current client size: 1920 1027 font 10 19
FIRST_PAINT: 544 msec
OnKeyDown: raw=ffe9 code=133 uni=0 ( ) ts=10766321 [now=10766322]
ConsoleInput::Enqueue: # 0 12 2 DOWN
OnKillFocus
ConsoleInput::Enqueue: # 0 12 0 UP
sxored commented 1 year ago

far2m started in WX mode from terminal shows blank black screen in separate GUI window and terminates if i press ctrl-c in terminal window

shmuz commented 1 year ago

far2m started in WX mode from terminal shows blank black screen in separate GUI window and terminates if i press ctrl-c in terminal window

This behavior I observed yesterday when I tested the PPA installation (on Linux Mint 20). This was the reason I prepared a special build with logging enabled (the last commit). If the next PPA will appear in time (in about 3-4 hours) then I will be able to debug the issue.

P.S. The PPA builds are here: https://launchpad.net/~far2l-team/+archive/ubuntu/lua

sxored commented 1 year ago

thanks for the link !

sxored commented 1 year ago

current date 2023-09-17

114 commits ago from now - 6956de9

91 commits ago from now - 9b1af2ae

$ expr \( 114 - 23 \) \* 3 / 4 + 23
91

$ git log | ... -91 | tail -n 1
* 9b1af2ae - Add function win.ExpandEnv (8 weeks ago) <Shmuel Zeigerman>

far2m started and works

shmuz commented 1 year ago

If you could try running it from under gdb this could give us much more information.

sxored commented 1 year ago

current date 2023-09-17

76 commits ago from now - 9fb36402

far2m terminates after start

77 commits ago from now - 594b0728

far2m started and works

$ git branch -avv
* (HEAD detached at 594b0728) 594b0728 LuaFAR API: make FarDialogItem (almost) identical to that of Far3

$ git checkout master
Previous HEAD position was 594b0728 LuaFAR API: make FarDialogItem (almost) identical to that of Far3
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

$ git branch -avv
  android                e69009dd [origin/android] Merge branch 'master' into android
  iconv                  edff7df4 [origin/iconv] cache iconv opens
* master                 ed4b2149 [origin/master] A special build with logging enabled (for PPA debugging)
  remotes/origin/HEAD    -> origin/master
  remotes/origin/android e69009dd Merge branch 'master' into android
  remotes/origin/iconv   edff7df4 cache iconv opens
  remotes/origin/master  ed4b2149 A special build with logging enabled (for PPA debugging)

$ expr \( 79 - 73 \) \* 1 / 2 + 73
76

$ expr \( 79 - 76 \) \* 1 / 2 + 76
77

$ git log | ... -76 | tail -n 1
* 9fb36402 - Refactoring (6 weeks ago) <Shmuel Zeigerman>

$ git log | ... -77 | tail -n 1
* 594b0728 - LuaFAR API: make FarDialogItem (almost) identical to that of Far3 (6 weeks ago) <Shmuel Zeigerman>
shmuz commented 1 year ago

@sxored This is invaluable! I hope to be able to understand the problem. But not today, probably tomorrow. Thanks again!

shmuz commented 1 year ago

Please try to run any bad build this way and see if it works: FARPLAINLUA=1 ./far2m --tty

sxored commented 1 year ago

gdb run far2m build 9fb36402

========
file far2m
set args --tty
b main
r
========
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".

...

Breakpoint 1 at 0x3c3e0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, 0x00005555555903e0 in main ()
(gdb) n

__libc_start_main (main=0x5555555903e0 <main>, argc=2, argv=0x7fffffffe178, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe168) at ../csu/libc-start.c:342
342     ../csu/libc-start.c: No such file or directory.
(gdb) n
[Inferior 1 (process 14591) exited with code 0377]
(gdb)  
sxored commented 1 year ago

gdb run far2m build 594b0728

========
file far2m
set args --tty
b main
r
========
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.

...

Breakpoint 1 at 0x3c3e0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, 0x00005555555903e0 in main ()
(gdb) n
Single stepping until exit from function main,
which has no line number information.

[Detaching after fork from child process 15032]

__libc_start_main (main=0x5555555903e0 <main>, argc=2, argv=0x7fffffffe178, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe168) at ../csu/libc-start.c:342
342 ../csu/libc-start.c: No such file or directory.
(gdb) quit
A debugging session is active.

    Inferior 1 [process 14976] will be killed.

Quit anyway? (y or n) n
Not confirmed.
(gdb) n
[Inferior 1 (process 14976) exited normally]
(gdb) quit
sxored commented 1 year ago

Please try to run any bad build this way and see if it works: FARPLAINLUA=1 ./far2m --tty

far2m build 9fb36402 works this way

FAR2M, version 2.5.0-9fb36402-beta Linux x86_64
Copyright (C) 1996-2000 Eugene Roshal, Copyright (C) 2000-2016 Far Group, Copyright (C) 2016-2023 Far People

While typing command:
 Ctrl+O - switch between panel/terminal.
 Ctrl+Up/+Down/+Left/+Right - adjust panels dimensions.
 Double Shift+TAB - bash-guided autocomplete.
 F3, F4, F8 - viewer/editor/clear terminal log (if panels are off).       
 Ctrl+Shift+MouseScrollUp - open autoclosing viewer with terminal log.    
While executing command:
 Ctrl+Shift+F3/+F4 - pause and open viewer/editor with console log.       
 Ctrl+Alt+C - terminate everything in this shell.
 Ctrl+Alt+Z - detach far2m application to background releasing terminal.  
 MouseScrollUp - pause and open autoclosing viewer with console log.      

/home/user$                                                                                                                                                                                                       ↑
1Left            2Right           3Name            4Extens          5Write           6Size            7Unsort          8Creatn          9Access          10Descr           11Owner           12Sort  
shmuz commented 1 year ago

The problem is more or less clear to me now. The reason why the behavior differs on different systems is different LuaJIT builds (I built LuaJIT myself on Mint 21). When running with FARPLAINLUA=1 lua5.1 is loaded instead of LuaJIT (if lua5.1 is installed). Nevertheless, as I have no control over LuaJIT builds on user systems I should fix this issue.

sxored commented 1 year ago

that is good news

thank you !

shmuz commented 1 year ago

@sxored Thank you for the great help in resolving this issue!