Summary: | sysutils/screen: update from 4.6.2_3 to 4.7.0_1 crashes on startup with TERM=rxvt (and some xterm variants) | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Marcin Cieślak <saper> | ||||||
Component: | Individual Port(s) | Assignee: | Christoph Moench-Tegeder <cmt> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | cmt | ||||||
Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(cy) |
||||||
Version: | Latest | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
Marcin Cieślak
2019-10-28 12:42:33 UTC
Created attachment 208652 [details] Quick fix : revert fad4c29fd95d30639a67142066f623396fca8536 A quick fix: Reverting this change to screen 4.x branch: commit fad4c29fd95d30639a67142066f623396fca8536 Author: Amadeusz Sławiński <amade@asmblr.net> Date: Sat Sep 7 17:58:50 2019 +0200 Fix broken mouse after ncurses 6.1 ncurses 6.1 changed kmous capability from "\e[M" to "\e[<". It seems to be done to signal that terminal supports sgr mouse mode. screen assumed that if kmous is set to "\e[M" it is on xterm compatible terminal anyway, so just dynamically detect which one is used and override relevant kmapdef. InitKeytab() is moved, so kmapdef[] can be overriden before initialization, as InitTermcap() needs to run first, as far as I can tell this should have no consequences. Signed-off-by: Amadeusz Sławiński <amade@asmblr.net> Created attachment 208653 [details]
fix coredump on xterm and rxvt and bump portrevision
Here's the rub: with TERM=xterm (or rxvt, for that matter), Km ("key_mouse", "Mouse event has occured") is not set (and therefore NULL), but InitTermcap() (termcap.c:230) happily tries to strdup() that, which gets us that segfault.
As a band-aid, catch that NULL and don't strdup().
Workaround: set TERM to a terminal with Km - for example, TERM="xterm-v220" works just fine.
Thanks, you patch is better :) I think it didn't crash for me with TERM=xterm though. tput says it is there: > tput -T xterm Km | hd 00000000 1b 5b 4d |.[M| 00000003 > tput -T rxvt Km || echo not found not found (In reply to Marcin Cieślak from comment #4) D'oh. Now that you mention that - I've set termName to "xterm-color" for my xterms (it has been years since I last touched my .Xresources...), and it's that xterm-color which has no Km (but it leaves TERM at "xterm", which confused me quite a bit). Yeah, real "xterm" is fine, but "xterm-color" (which disguises as xterm) is a problem. Upstream report: https://lists.gnu.org/archive/html/screen-users/2019-10/msg00003.html Since screen is again in active development, maybe we should upstream some of our local patches there? (In reply to Christoph Moench-Tegeder from comment #2) I'm at $JOB at the moment. Can you commit this for me please? Consider this my approval. A commit references this bug: Author: cmt Date: Mon Oct 28 14:42:21 UTC 2019 New revision: 515868 URL: https://svnweb.freebsd.org/changeset/ports/515868 Log: sysutils/screen: fix coredump on xterm/rxvt variants without Km On xterm- and rxvt-variants (and in some other cases) screen's InitTermcap() tries to strdup() the terminals "Km" ("key_mouse") termcap attribute - but that might be NULL, as some of these terminals (notably rxvt and xterm-color) do not have "Km". Trying to strdup() NULL results in segfault and coredump. Catch that NULL and prevent the segfault. PR: 241538 Reported by: Marcin Cie?lak, Gareth de Vaux Approved by: cy@ Changes: head/sysutils/screen/Makefile head/sysutils/screen/files/patch-termcap.c committed as ports r515868 - thanks. 2 hours to fix - yay \o/ big thanks everyone! I have submitted the patch upstream: https://lists.gnu.org/archive/html/screen-devel/2019-11/msg00013.html https://lists.gnu.org/archive/html/screen-devel/2019-11/msg00014.html I hope this is ok for you Christoph! (In reply to Marcin Cieślak from comment #11) screen is GPLed, so yeah, it's fine (and really, rather trivial, once you see it). |