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

segfault #1

Closed
MaxGyver83 opened this issue Jan 2, 2023 · 16 comments
Closed

segfault #1

MaxGyver83 opened this issue Jan 2, 2023 · 16 comments

Comments

@MaxGyver83
Copy link
Contributor

MaxGyver83 commented Jan 2, 2023

Hi Ross,

I just tried a4 (after seeing its announcement on the suckless mailing list).
After playing around with it for a minute or two, I get a segmentation fault. I can't reproduce it reliably with a certain sequence of the key strokes, but it happened several times after using these commands (in random order):

  • Ctrl-g c
  • Ctrl-g 2
  • Ctrl-g 1
  • Ctrl-g .
  • Ctrl-g Enter

(I think Ctrl-g . and Ctrl-g Enter were the last before the crash.)

Maybe these coredumps help:

Update (with a debug build):

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055f78034247b in vts_sb_popline (cols=232, cells=0x55f781fe9380, user=0x55f781ff1dc0) at /home/max/repos/a4/vt.c:167
167                             .fg = tframe->cs->fg,

Versions

@rpmohn
Copy link
Owner

rpmohn commented Jan 2, 2023

The git mirror of libtickit is not up-to-date. Not sure if that'll fix it, but it's a good place to start. If you can't grab the bzr repo directly, I've attached a tarball of rev 810 that you can use.

bzr branch https://bazaar.leonerd.org.uk/c/libvterm/

Please let me know, thanks! -Ross
libtickit_r810.tar.gz

@MaxGyver83
Copy link
Contributor Author

Thank you. After building and installing libtickit from your tarball, I got the same segfault.

So to be sure, I have installed bzr and cloned the repository and installed again. Same error:

coredump3.txt

@MaxGyver83
Copy link
Contributor Author

Maybe this helps: I have commented in all occurrences of DEBUG_LOGF in vts_sb_popline and logged the "Uvp" flag:

tickit.log

@rpmohn
Copy link
Owner

rpmohn commented Jan 4, 2023

Thanks, here are some questions that might help me:

  • Please post the output of ldd /usr/local/bin/a4.
  • What OS/distro and version are you running?
  • What version of st are you running (I tested with 0.8.4, and then upgraded it and tested again on 0.9)?
  • Can you reproduce this with a different terminal emulator? In a console?

@MaxGyver83
Copy link
Contributor Author

$ ldd /usr/local/bin/a4
        linux-vdso.so.1 (0x00007ffc37187000)
        libtickit.so.3 => /usr/local/lib/libtickit.so.3 (0x00007feb2a123000)
        libvterm.so.0 => /usr/local/lib/libvterm.so.0 (0x00007feb2a10b000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007feb29f24000)
        libunibilium.so.4 => /usr/lib/libunibilium.so.4 (0x00007feb29f0f000)
        libtermkey.so.1 => /usr/lib/libtermkey.so.1 (0x00007feb29f03000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007feb2a195000)

I use Arch Linux.

I couldn't reproduce this with xterm or in a console. Only with st, both my custom build and a clean build of the latest commit (e5e9598).

@MaxGyver83
Copy link
Contributor Author

And to be more specific about the segfault I get:

Core was generated by `a4/a4'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00005589fa60753a in vts_sb_popline (cols=148, cells=0x5589fad45ac0, user=0x5589facabaf0) at /home/max/repos/a4/vt.c:167
167                             .fg = tframe->cs->fg,
>>> p tframe->cs
$1 = (ColorScheme *) 0x0
>>>

tframe->cs is a null pointer. Maybe you have an idea what could have caused this.

@rpmohn
Copy link
Owner

rpmohn commented Jan 6, 2023

  1. Can you confirm that you're only using the default a4.ini file? If not, please post what you're using.
  2. What shell are you using?
  3. Do your terminal windows in a4 have titlebar text, or is it blank? If you're not sure, please post a screenshot of what it looks like just before the crash. I suspect this is the problem and I can send you a patch to test.

@MaxGyver83
Copy link
Contributor Author

MaxGyver83 commented Jan 6, 2023

  1. Yes. (No custom configuration.)
  2. The default shell is bash. (And it seems to make no difference if I start a4 from bash or fish.)
  3. Indeed, the titlebar is blank (apart from [#1]) when I run a4 in st.

Screenshot:
2023-01-06 17 04 08 1010x705 Region
(top: st, bottom: xterm)

@rpmohn
Copy link
Owner

rpmohn commented Jan 6, 2023

Please apply and test this one line patch. If that resolves the segfault, as I suspect it will, then I'll make a couple more similar updates to make the whole thing more robust. Thanks!

patch <default_cs.txt

default_cs.txt

@MaxGyver83
Copy link
Contributor Author

Thank you. No crashes so far! tframe->cs is not NULL anymore (as expected :-) ). But the titlebars are still blank.

@rpmohn
Copy link
Owner

rpmohn commented Jan 6, 2023

Titlebar text is typically controlled in bash by setting PROMPT_COMMAND in your .bashrc file, and then you can make color rules in a4.ini to match the text and change the color scheme of individual terminal windows. Here's the standard example, and you can change the titlebar text in other ways as well for additional control.

PROMPT_COMMAND='echo -ne "\e]0;$USER@$HOSTNAME:${PWD/$HOME/\~}\a"'

@rpmohn
Copy link
Owner

rpmohn commented Jan 6, 2023

Here's a fun example screenshot showing an extreme use of multiple terminal color schemes:
image

@rpmohn
Copy link
Owner

rpmohn commented Jan 13, 2023

Pushed 8036fd9 to resolve this. Thanks for your help!

@rpmohn rpmohn closed this as completed Jan 13, 2023
@rpmohn rpmohn reopened this Jan 20, 2023
@rpmohn
Copy link
Owner

rpmohn commented Jan 20, 2023

Actually, that patch is not good as it inhibits the initial colorscheme from being applied. This updated one line patch will both set and apply the initial default colors. Please let me know if you're able to validate, thanks!

patch < applydefaultcs.txt

applydefaultcs.txt

@MaxGyver83
Copy link
Contributor Author

I have tested it and it works as expected! Thank you.

@rpmohn
Copy link
Owner

rpmohn commented Jan 23, 2023

Reclosing with improved fix bce5e14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants