Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctrl+c in notcurses-input on linux results in segfault #2842

Closed
dankamongmen opened this issue Jan 14, 2025 · 7 comments
Closed

ctrl+c in notcurses-input on linux results in segfault #2842

dankamongmen opened this issue Jan 14, 2025 · 7 comments
Assignees
Labels
bug Something isn't working input readin' dem bytes linux jake, this is penguintown
Milestone

Comments

@dankamongmen
Copy link
Owner

Looking to see if #2840 could be reproduced on linux, i ran notcurses-input 3.0.13 in kitty. upon pressing ctrl+c, we immediately crashed.

@dankamongmen dankamongmen added bug Something isn't working linux jake, this is penguintown input readin' dem bytes labels Jan 14, 2025
@dankamongmen dankamongmen added this to the 3.1.0 milestone Jan 14, 2025
@dankamongmen dankamongmen self-assigned this Jan 14, 2025
@dankamongmen
Copy link
Owner Author

           PID: 1390889 (notcurses-input)
           UID: 1000 (dank)
           GID: 1000 (dank)
        Signal: 11 (SEGV)
     Timestamp: Tue 2025-01-14 13:40:59 EST (2min 18s ago)
  Command Line: notcurses-input
    Executable: /usr/bin/notcurses-input
 Control Group: /user.slice/user-1000.slice/user@1000.service/kitty-1390312-0.scope
          Unit: user@1000.service
     User Unit: kitty-1390312-0.scope
         Slice: user-1000.slice
     Owner UID: 1000 (dank)
       Boot ID: 59b712c9b389474dbd4353ad59c9c7a0
    Machine ID: 61e1fce29000497e8788854e624c7467
      Hostname: schwarzgerat
       Storage: /var/lib/systemd/coredump/core.notcurses-input.1000.59b712c9b389474dbd4353ad59c9c7a0.1390889.1736880059000000.zst (present)
  Size on Disk: 527.5K
       Message: Process 1390889 (notcurses-input) of user 1000 dumped core.
                
                Module libsystemd.so.0 from deb systemd-257.2-1.amd64
                Module libgcc_s.so.1 from deb gcc-14-14.2.0-13.amd64
                Module libstdc++.so.6 from deb gcc-14-14.2.0-13.amd64
                Stack trace of thread 1390913:
                #0  0x00007f5e4110bb8e drop_signals (libnotcurses-core.so.3 + 0x5fb8e)
                #1  0x00007f5e410e41e8 notcurses_stop_minimal (libnotcurses-core.so.3 + 0x381e8)
                #2  0x00007f5e4110b904 fatal_handler (libnotcurses-core.so.3 + 0x5f904)
                #3  0x00007f5e40c49da0 __restore_rt (libc.so.6 + 0x3fda0)
                #4  0x00007f5e40c9dd8c __pthread_kill_implementation (libc.so.6 + 0x93d8c)
                #5  0x00007f5e40c49d02 __GI_raise (libc.so.6 + 0x3fd02)
                #6  0x00007f5e410d0560 kitty_kbd_txt (libnotcurses-core.so.3 + 0x24560)
                #7  0x00007f5e410d0e5d kitty_kbd (libnotcurses-core.so.3 + 0x24e5d)
                #8  0x00007f5e410d1220 process_escape (libnotcurses-core.so.3 + 0x25220)
                #9  0x00007f5e410d27a8 process_escape (libnotcurses-core.so.3 + 0x267a8)
                #10 0x00007f5e410d30f9 process_ibuf (libnotcurses-core.so.3 + 0x270f9)
                #11 0x00007f5e40c9c043 start_thread (libc.so.6 + 0x92043)
                #12 0x00007f5e40d1a778 __clone3 (libc.so.6 + 0x110778)
                
                Stack trace of thread 1390889:
                #0  0x00007f5e40c989de __futex_abstimed_wait_common64 (libc.so.6 + 0x8e9de)
                #1  0x00007f5e40c9b280 __pthread_cond_wait_common (libc.so.6 + 0x91280)
                #2  0x00007f5e410d45ea internal_get (libnotcurses-core.so.3 + 0x285ea)
                #3  0x000055bc0dd165da n/a (n/a + 0x0)
                ELF object binary architecture: AMD x86-64

@dankamongmen
Copy link
Owner Author

ick, this might be a regression from the work in 3.0.12 for #2828

@dankamongmen
Copy link
Owner Author

ok, got the problem here, we need handle the altstack == NULL case in drop_signals(), from when we come in via the fatal signal handler. but we're still eliciting the segfault.

@dankamongmen
Copy link
Owner Author

dankamongmen commented Jan 14, 2025

alright, well now at least we're not leaving the terminal useless. but why are we crashing? it's in shutdown; it comes after the shutdown process starts:

mark_pipe_ready:475:wrote to readiness pipe
internal_get:2728:draining event readiness pipe 0
reset_term_palette:82:restoring palette via xtpopcolors
notcurses_stop_minimal:173:restored terminal, returning 2
[schwarzgerat](130) $

@dankamongmen
Copy link
Owner Author

oh, that's not a segfault, that's SIGINT and correct behavior.

@dankamongmen
Copy link
Owner Author

and getting the 130 exit code is also correct for SIGINT (128 + 2). so we're good now.

@dankamongmen
Copy link
Owner Author

ok so i think we're done here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working input readin' dem bytes linux jake, this is penguintown
Projects
None yet
Development

No branches or pull requests

1 participant