okbob / pspg

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.
BSD 2-Clause "Simplified" License
2.43k stars 85 forks source link

pspg crashes when copying long text #221

Closed dmfay closed 1 year ago

dmfay commented 1 year ago
select repeat('abcdefghijklmnopqrstuvwxyz', 100);

File -> Copy to -> Copy

pspg pauses for a second or two before announcing pspg crashed by signal 11.

okbob commented 1 year ago

your example is working on my comp without any problems. What is result of pspg --info ? Can you send stacktrace?

dmfay commented 1 year ago
pspg-5.7.4
with readline (version: 0x0802)
with integrated menu
ncurses version: 6.4, patch: 20221231
ncurses with wide char support
ncurses widechar num: 0
wchar_t width: 4, max: 2147483647
with ncurses extended functions support no: 20221231
without ncurses extended colors
with postgres client integration
without inotify support
with kqueue support
Darwin nungal.xyzxyz.xyz 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64

here's a log file, no stack trace though:

Sat Apr  1 15:28:15 2023 [30492] opening custom theme style "/Users/dian/.pspg_theme_warm_dark"
Sat Apr  1 15:28:15 2023 [30492] started
Sat Apr  1 15:28:15 2023 [30492] with utf8 support
Sat Apr  1 15:28:15 2023 [30492] esc delay = -1
Sat Apr  1 15:28:15 2023 [30492] DataDesc is initialized
Sat Apr  1 15:28:15 2023 [30492] next row will be data row
Sat Apr  1 15:28:15 2023 [30492] read rows 5
Sat Apr  1 15:28:15 2023 [30492] read input 5 rows
Sat Apr  1 15:28:15 2023 [30492] terminal size by TIOCGWINSZ rows: 24, cols: 80
Sat Apr  1 15:28:15 2023 [30492] ncurses started
Sat Apr  1 15:28:15 2023 [30492] kmous=\E[<, TERM=xterm-256color
Sat Apr  1 15:28:15 2023 [30492] xterm mouse mode 1002 will be used
Sat Apr  1 15:28:15 2023 [30492] template theme 22 loaded
Sat Apr  1 15:28:15 2023 [30492] use custom theme "warm_dark"
Sat Apr  1 15:28:15 2023 [30492] xterm mouse mode 1002 activated
Sat Apr  1 15:28:15 2023 [30492] initial stdscr size - maxy: 24, maxx: 80
Sat Apr  1 15:28:15 2023 [30492] use custom menu template 7
Sat Apr  1 15:28:16 2023 [30492] new screen size 24 80
Sat Apr  1 15:28:16 2023 [30492] releasing cmd bar
Sat Apr  1 15:28:16 2023 [30492] process command: ShowMenu
Sat Apr  1 15:28:16 2023 [30492] use custom menu template 7
Sat Apr  1 15:28:16 2023 [30492] init menu
Sat Apr  1 15:28:19 2023 [30492] new screen size 24 80
Sat Apr  1 15:28:19 2023 [30492] releasing cmd bar
Sat Apr  1 15:28:19 2023 [30492] process command: Copy
Sat Apr  1 15:28:22 2023 [30492] xterm mouse mode 1002 is deactivated
Sat Apr  1 15:28:22 2023 [30492] pspg crashed by Sig 11

On Linux (vs osx) it does copy successfully without crashing, here's that pspg --info:

pspg-5.7.3
with readline (version: 0x0802)
with integrated menu
ncurses version: 6.4, patch: 20221231
ncurses with wide char support
ncurses widechar num: 1
wchar_t width: 4, max: 2147483647
with ncurses extended functions support no: 20221231
with ncurses extended colors no: 20221231
with postgres client integration
with inotify support
without kqueue support
Linux medusa 6.2.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 11 Mar 2023 14:28:13 +0000 x86_64
okbob commented 1 year ago

so 1. 4. 2023 v 21:33 odesílatel Dian Fay @.***> napsal:

pspg-5.7.4 with readline (version: 0x0802) with integrated menu ncurses version: 6.4, patch: 20221231 ncurses with wide char support ncurses widechar num: 0 wchar_t width: 4, max: 2147483647 with ncurses extended functions support no: 20221231 without ncurses extended colors with postgres client integration without inotify support with kqueue support Darwin nungal.attlocal.net 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64

here's a log file, no stack trace though:

Sat Apr 1 15:28:15 2023 [30492] opening custom theme style "/Users/dian/.pspg_theme_warm_dark" Sat Apr 1 15:28:15 2023 [30492] started Sat Apr 1 15:28:15 2023 [30492] with utf8 support Sat Apr 1 15:28:15 2023 [30492] esc delay = -1 Sat Apr 1 15:28:15 2023 [30492] DataDesc is initialized Sat Apr 1 15:28:15 2023 [30492] next row will be data row Sat Apr 1 15:28:15 2023 [30492] read rows 5 Sat Apr 1 15:28:15 2023 [30492] read input 5 rows Sat Apr 1 15:28:15 2023 [30492] terminal size by TIOCGWINSZ rows: 24, cols: 80 Sat Apr 1 15:28:15 2023 [30492] ncurses started Sat Apr 1 15:28:15 2023 [30492] kmous=\E[<, TERM=xterm-256color Sat Apr 1 15:28:15 2023 [30492] xterm mouse mode 1002 will be used Sat Apr 1 15:28:15 2023 [30492] template theme 22 loaded Sat Apr 1 15:28:15 2023 [30492] use custom theme "warm_dark" Sat Apr 1 15:28:15 2023 [30492] xterm mouse mode 1002 activated Sat Apr 1 15:28:15 2023 [30492] initial stdscr size - maxy: 24, maxx: 80 Sat Apr 1 15:28:15 2023 [30492] use custom menu template 7 Sat Apr 1 15:28:16 2023 [30492] new screen size 24 80 Sat Apr 1 15:28:16 2023 [30492] releasing cmd bar Sat Apr 1 15:28:16 2023 [30492] process command: ShowMenu Sat Apr 1 15:28:16 2023 [30492] use custom menu template 7 Sat Apr 1 15:28:16 2023 [30492] init menu Sat Apr 1 15:28:19 2023 [30492] new screen size 24 80 Sat Apr 1 15:28:19 2023 [30492] releasing cmd bar Sat Apr 1 15:28:19 2023 [30492] process command: Copy Sat Apr 1 15:28:22 2023 [30492] xterm mouse mode 1002 is deactivated Sat Apr 1 15:28:22 2023 [30492] pspg crashed by Sig 11

On Linux (vs osx) it does copy successfully without crashing, here's that pspg --info:

pspg-5.7.3 with readline (version: 0x0802) with integrated menu ncurses version: 6.4, patch: 20221231 ncurses with wide char support ncurses widechar num: 1 wchar_t width: 4, max: 2147483647 with ncurses extended functions support no: 20221231 with ncurses extended colors no: 20221231 with postgres client integration with inotify support without kqueue support Linux medusa 6.2.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 11 Mar 2023 14:28:13 +0000 x86_64

I am not sure, I am afraid so it crashes inside pbcopy :-/ - so this is the reason why I need stack.

Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/221#issuecomment-1493084529, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO4YGOHNZMTD7WOLE7JDW7B7GZANCNFSM6AAAAAAWN2UDZM . You are receiving this because you commented.Message ID: @.***>

dmfay commented 1 year ago

I attached lldb to a running pspg and triggered the error:

Process 32905 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x600020000000)
    frame #0: 0x000000010be94552 pspg`dsplen + 4
pspg`dsplen:
->  0x10be94552 <+4>:  cmpb   $0x20, (%rdi)
    0x10be94555 <+7>:  je     0x10be94569               ; <+27>
    0x10be94557 <+9>:  leaq   0x1efd2(%rip), %rax       ; use_utf8
    0x10be9455e <+16>: cmpb   $0x0, (%rax)
Target 0: (pspg) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x600020000000)
  * frame #0: 0x000000010be94552 pspg`dsplen + 4
    frame #1: 0x000000010be96d82 pspg`multilines_detection + 350
    frame #2: 0x000000010be98170 pspg`export_data + 964
    frame #3: 0x000000010be88edb pspg`export_to_file + 2058
    frame #4: 0x000000010be8cb3e pspg`main + 14275
    frame #5: 0x00007ff814b3941f dyld`start + 1903

is this what you're looking for?

okbob commented 1 year ago

ne 2. 4. 2023 v 1:07 odesílatel Dian Fay @.***> napsal:

I attached lldb to a running pspg and triggered the error:

Process 32905 stopped

  • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x600020000000) frame #0: 0x000000010be94552 pspgdsplen + 4 pspgdsplen: -> 0x10be94552 <+4>: cmpb $0x20, (%rdi) 0x10be94555 <+7>: je 0x10be94569 ; <+27> 0x10be94557 <+9>: leaq 0x1efd2(%rip), %rax ; use_utf8 0x10be9455e <+16>: cmpb $0x0, (%rax) Target 0: (pspg) stopped. (lldb) bt
  • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x600020000000)
    • frame #0: 0x000000010be94552 pspgdsplen + 4 frame #1: 0x000000010be96d82 pspgmultilines_detection + 350 frame #2: 0x000000010be98170 pspgexport_data + 964 frame #3: 0x000000010be88edb pspgexport_to_file + 2058 frame #4: 0x000000010be8cb3e pspgmain + 14275 frame #5: 0x00007ff814b3941f dyldstart + 1903

is this what you're looking for?

it is better, so it really crashes inside pspg

please, can you compile pspg with -g and O0 flags, and get stacktrace again?

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/221#issuecomment-1493165395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO44AI6TZFLY3KGC34J3W7CYK3ANCNFSM6AAAAAAWN2UDZM . You are receiving this because you commented.Message ID: @.***>

okbob commented 1 year ago

ne 2. 4. 2023 v 7:37 odesílatel Pavel Stehule @.***> napsal:

ne 2. 4. 2023 v 1:07 odesílatel Dian Fay @.***> napsal:

I attached lldb to a running pspg and triggered the error:

Process 32905 stopped

  • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x600020000000) frame #0: 0x000000010be94552 pspgdsplen + 4 pspgdsplen: -> 0x10be94552 <+4>: cmpb $0x20, (%rdi) 0x10be94555 <+7>: je 0x10be94569 ; <+27> 0x10be94557 <+9>: leaq 0x1efd2(%rip), %rax ; use_utf8 0x10be9455e <+16>: cmpb $0x0, (%rax) Target 0: (pspg) stopped. (lldb) bt
  • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x600020000000)
    • frame #0: 0x000000010be94552 pspgdsplen + 4 frame #1: 0x000000010be96d82 pspgmultilines_detection + 350 frame #2: 0x000000010be98170 pspgexport_data + 964 frame #3: 0x000000010be88edb pspgexport_to_file + 2058 frame #4: 0x000000010be8cb3e pspgmain + 14275 frame #5: 0x00007ff814b3941f dyldstart + 1903

is this what you're looking for?

it is better, so it really crashes inside pspg

please, can you compile pspg with -g and O0 flags, and get stacktrace again?

I am able to repeat it now - there are some problems when border is 1

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/221#issuecomment-1493165395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO44AI6TZFLY3KGC34J3W7CYK3ANCNFSM6AAAAAAWN2UDZM . You are receiving this because you commented.Message ID: @.***>

okbob commented 1 year ago

should be fixed by 5bf62221b93c091ed7607a293a21d728efd5f45d, please check

dmfay commented 1 year ago

Seems to be working here, thank you! 🎉

okbob commented 1 year ago

ne 2. 4. 2023 v 18:12 odesílatel Dian Fay @.***> napsal:

Seems to be working here, thank you! 🎉

Thank you for check and for report

— Reply to this email directly, view it on GitHub https://github.com/okbob/pspg/issues/221#issuecomment-1493381732, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO44HM3UJAQ3HNCYQGYDW7GQNTANCNFSM6AAAAAAWN2UDZM . You are receiving this because you commented.Message ID: @.***>