bugGNU Screen - Bugs: bug #63619, screen crashes on reattach in st...


bug #63619: screen crashes on reattach in st terminal

Submitter:  Axel Svensson <axelsvensson>
Submitted:  Wed 04 Jan 2023 02:08:13 PM UTC
Category:  Crash/Freeze/Infloop Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Need Info
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  4.8.0
Fixed Release:  None Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Sat 14 Oct 2023 01:26:18 PM UTC, comment #6: 

It's nice that we have fix for st terminal crashes, but it seems that screen crashes by reattach in st terminal only. We have TERMCAP_BUFSIZE 1023 in screen-v4 and master and it seems nobody have a problem with this value... except of st-guys.

We set it to 1023 few years ago[1] and I don't want to change it back and forth release to release. I would like to have a patch where this change will affect st-users only.

[1] https://git.savannah.gnu.org/cgit/screen.git/commit/?h=screen-v4&id=241553f21ce38eae821ea4c1e12241365563d444

Alexander Naumov <anaumov>
Group administrator
Wed 11 Oct 2023 11:11:21 PM UTC, comment #5: 

Currently on Gentoo, was having issues with st and can confirm the patch fixed it.

example patch file, located in /etc/portage/patches/app-misc/screen/st-fix.patch

diff --git a/os.h b/os.h
index 2a1c2ca..40402ae 100644
--- a/os.h
+++ b/os.h
@@ -507,7 +507,7 @@ typedef struct fd_set { int fds_bits[1]; } fd_set;

-# define TERMCAP_BUFSIZE 1023
+# define TERMCAP_BUFSIZE 1111


Fri 15 Sep 2023 02:12:01 PM UTC, comment #4: 

Hi, I don't know if this is helpful but just wanted to confirm that this happens for me on Arch linux, signal 11 caught when I try to reattach to a local screen session in st. Reattach works fine in the framebuffer console, and works fine over ssh to another Arch box, so this certainly seems to be a st specific problem, but not a MacOS specific one.

Mon 14 Aug 2023 07:22:44 PM UTC, comment #3: 

I don't think you need MacOS to reproduce this. I run some gentoo linux installations, I use st as a terminal emulator, and screen crashes regularly with 'sig 11 caught' when I try to reaattach to a screen session. This workaround makes screen at least usable again for me.

Fri 28 Jul 2023 10:26:24 AM UTC, comment #2: 

Can you test this patch please?

--- a/src/os.h
+++ b/src/os.h
@@ -507,7 +507,11 @@ typedef struct fd_set { int fds_bits[1]; } fd_set;

+#ifdef __APPLE__
 # define TERMCAP_BUFSIZE 1023
+# define TERMCAP_BUFSIZE 1111

Yes, it is a dirty workaround, but i just want to know if it fixes the problem or not. Unfortunately, I don't have macOS on hand, so it's hard to get to the root of the problem.

Alexander Naumov <anaumov>
Group administrator
Thu 27 Jul 2023 11:09:09 PM UTC, comment #1: 

Thank you for reporting.

As I can see, you use master(4.99), not 4.8.0, right?
Can you provide the info about your OS and ncurces version please?

Just to increase the bufsize is not the good solution for me.

Alexander Naumov <anaumov>
Group administrator
Wed 04 Jan 2023 02:08:13 PM UTC, original submission:  

To reproduce:

# Install st terminal
> git clone https://git.suckless.org/st
> cd st
> git checkout e5e959835b195c023d1f685ef4dbbcfc3b5120b2
> make install

# Check that you get the expected termcap
> sha256sum /etc/terminfo/s/st-256color
f3c62ac3c07d4e90627be14d8af0c729d2c7592ef2a1da2e3baded1814a924e6  /etc/terminfo/s/st-256color

# Start st and do the rest from inside this terminal.
> st

# Check that the TERM variable is set correctly
> echo $TERM

# Compile and run screen from the commit where the problem was introduced
> git clone https://git.savannah.gnu.org/git/screen.git
> cd screen/src
> git checkout 241553f21ce38eae821ea4c1e12241365563d444
> git clean -fdx && ./autogen.sh && ./configure && make
> ./screen -RS a
# Press Ctrl+A D to detach
# Reattach
> ./screen -RS a

screen reattaches

screen crashes with message "[screen caught signal 11. (core dumped)]".

This behavior depends to some degree on the constant TERMCAP_BUFSIZE in src/os.h (with a value of 1023 in the referenced snapshot).
If this constant is set to a value in the range 914-1025, screen will crash on reattach as described above under "Actual".
If it is set to a value in the range 1026-1105, screen will instead hang on detach.
A value of 1106 or above will produce the expected behavior.

Axel Svensson <axelsvensson>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by anaumov (Posted a comment)
  • -email is unavailable- added by axelsvensson (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-07-27 anaumov StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-c54d.
    Corresponding source code