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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pspg crashes when copying long text

dmfay opened this issue · comments

select repeat('abcdefghijklmnopqrstuvwxyz', 100);

File -> Copy to -> Copy

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

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

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

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?

should be fixed by 5bf6222, please check

Seems to be working here, thank you! 🎉