Date: Tue, 29 Oct 2019 04:23:45 +0000 (UTC) From: Cy Schubert <cy@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r515952 - in head/sysutils/screen: . files Message-ID: <201910290423.x9T4NjaT049846@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cy Date: Tue Oct 29 04:23:45 2019 New Revision: 515952 URL: https://svnweb.freebsd.org/changeset/ports/515952 Log: Resolve upstream bug #55482: TERMCAP can break on systems that don't support terminfo Obtained from: https://savannah.gnu.org/bugs/?55482 Added: head/sysutils/screen/files/patch-extern.h (contents, props changed) head/sysutils/screen/files/patch-fileio.c (contents, props changed) head/sysutils/screen/files/patch-term.c (contents, props changed) Modified: head/sysutils/screen/Makefile (contents, props changed) head/sysutils/screen/files/patch-os.h (contents, props changed) head/sysutils/screen/files/patch-termcap.c (contents, props changed) Modified: head/sysutils/screen/Makefile ============================================================================== --- head/sysutils/screen/Makefile Tue Oct 29 03:42:56 2019 (r515951) +++ head/sysutils/screen/Makefile Tue Oct 29 04:23:45 2019 (r515952) @@ -3,7 +3,7 @@ PORTNAME= screen PORTVERSION= 4.7.0 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= sysutils MASTER_SITES= GNU \ ftp://ftp.gnu.org/gnu/screen/ \ Added: head/sysutils/screen/files/patch-extern.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/screen/files/patch-extern.h Tue Oct 29 04:23:45 2019 (r515952) @@ -0,0 +1,10 @@ +--- extern.h.orig 2019-10-01 15:08:00.000000000 -0700 ++++ extern.h 2019-10-28 19:37:41.584313000 -0700 +@@ -235,6 +235,7 @@ + /* termcap.c */ + extern int InitTermcap __P((int, int)); + extern char *MakeTermcap __P((int)); ++extern void DumpTermcap __P((int, FILE *)); + extern char *gettermcapstring __P((char *)); + #ifdef MAPKEYS + extern int remap __P((int, int)); Added: head/sysutils/screen/files/patch-fileio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/screen/files/patch-fileio.c Tue Oct 29 04:23:45 2019 (r515952) @@ -0,0 +1,14 @@ +--- fileio.c.orig 2019-10-01 15:08:00.000000000 -0700 ++++ fileio.c 2019-10-28 19:37:41.585000000 -0700 +@@ -480,10 +480,7 @@ + break; + + case DUMP_TERMCAP: +- if ((p = index(MakeTermcap(fore->w_aflag), '=')) != NULL) { +- fputs(++p, f); +- putc('\n', f); +- } ++ DumpTermcap(fore->w_aflag, f); + break; + + #ifdef COPY_PASTE Modified: head/sysutils/screen/files/patch-os.h ============================================================================== --- head/sysutils/screen/files/patch-os.h Tue Oct 29 03:42:56 2019 (r515951) +++ head/sysutils/screen/files/patch-os.h Tue Oct 29 04:23:45 2019 (r515952) @@ -1,5 +1,5 @@ --- os.h.orig 2019-10-01 15:08:00.000000000 -0700 -+++ os.h 2019-10-08 04:49:54.436485000 -0700 ++++ os.h 2019-10-28 19:37:41.585526000 -0700 @@ -250,9 +250,11 @@ #endif @@ -14,6 +14,15 @@ # define utmp utmpx # define getutent getutxent # define getutid getutxid +@@ -507,7 +509,7 @@ + */ + + #ifndef TERMCAP_BUFSIZE +-# define TERMCAP_BUFSIZE 2048 ++# define TERMCAP_BUFSIZE 1023 + #endif + + #ifndef MAXPATHLEN @@ -524,6 +526,6 @@ /* Changing those you won't be able to attach to your old sessions * when changing those values in official tree don't forget to bump Added: head/sysutils/screen/files/patch-term.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/screen/files/patch-term.c Tue Oct 29 04:23:45 2019 (r515952) @@ -0,0 +1,10 @@ +--- term.c.orig 2019-10-01 15:08:00.000000000 -0700 ++++ term.c 2019-10-28 19:37:41.585983000 -0700 +@@ -197,6 +197,7 @@ + { "F1", T_STR }, KMAPDEF("\033[23~") + { "F2", T_STR }, KMAPDEF("\033[24~") + /* extra keys for vt220 (David.Leonard@it.uq.edu.au) */ ++/* define T_FEXTRA */ + { "F3", T_STR }, + { "F4", T_STR }, + { "F5", T_STR }, Modified: head/sysutils/screen/files/patch-termcap.c ============================================================================== --- head/sysutils/screen/files/patch-termcap.c Tue Oct 29 03:42:56 2019 (r515951) +++ head/sysutils/screen/files/patch-termcap.c Tue Oct 29 04:23:45 2019 (r515952) @@ -1,6 +1,22 @@ ---- termcap.c.orig 2019-10-01 22:08:00 UTC -+++ termcap.c -@@ -227,7 +227,7 @@ int he; +--- termcap.c.orig 2019-10-01 15:08:00.000000000 -0700 ++++ termcap.c 2019-10-28 19:37:41.586957000 -0700 +@@ -75,11 +75,10 @@ + + char *extra_incap, *extra_outcap; + +-static const char TermcapConst[] = "\\\n\ +-\t:DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:UP=\\E[%dA:bs:bt=\\E[Z:\\\n\ +-\t:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:ct=\\E[3g:\\\n\ +-\t:do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\\\n\ +-\t:le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E)0:"; ++static const char TermcapConst[] = "DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:\ ++UP=\\E[%dA:bs:bt=\\E[Z:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:\ ++ct=\\E[3g:do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\ ++le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E)0:"; + + char * + gettermcapstring(s) +@@ -227,7 +226,7 @@ (D_CKM && (InStr(D_CKM, "\033[M") || InStr(D_CKM, "\033[<")))) { D_CXT = 1; @@ -9,7 +25,7 @@ } /* "be" seems to be standard for xterms... */ if (D_CXT) -@@ -362,11 +362,7 @@ int he; +@@ -362,11 +361,7 @@ if (D_CG0) { if (D_CS0 == 0) @@ -22,3 +38,77 @@ if (D_CE0 == 0) D_CE0 = "\033(B"; D_AC = 0; +@@ -827,21 +822,13 @@ + char *s; + { + register int n; +- +- if (tcLineLen + (n = strlen(s)) > 55 && Termcaplen < TERMCAP_BUFSIZE - 4 - 1) +- { +- strcpy(Termcap + Termcaplen, "\\\n\t:"); +- Termcaplen += 4; +- tcLineLen = 0; +- } ++ n=strlen(s); + if (Termcaplen + n < TERMCAP_BUFSIZE - 1) + { + strcpy(Termcap + Termcaplen, s); + Termcaplen += n; + tcLineLen += n; + } +- else +- Panic(0, "TERMCAP overflow - sorry."); + } + + /* +@@ -1077,6 +1064,12 @@ + { + if (i >= T_KEYPAD) /* don't put keypad codes in TERMCAP */ + continue; /* - makes it too big */ ++#if (TERMCAP_BUF < 1024) ++ if (i >= T_FEXTRA && i < T_BACKTAB) /* also skip extra vt220 keys */ ++ continue; ++ if (i > T_BACKTAB && i < T_NAVIGATE) /* more vt220 keys */ ++ continue; ++#endif + if (i >= T_CURSOR && i < T_OCAPS) + { + act = &umtab[i - (T_CURSOR - T_OCAPS + T_CAPS)]; +@@ -1129,6 +1122,37 @@ + } + debug("MakeTermcap: end\n"); + return Termcap; ++} ++ ++#define TERMCAP_MAX_WIDTH 63 ++void ++DumpTermcap(aflag, f) ++int aflag; ++FILE *f; ++{ ++ register const char *p, *pe; ++ int n, col=0; ++ ++ if ((p = index(MakeTermcap(aflag), '=')) == NULL) ++ return; ++ p++; ++ debug1("DumpTermcap: '%s'\n", p); ++ /* write termcap entry with wrapping */ ++ while((pe = index(p, ':'))) ++ { ++ n = pe - p + 1; ++ if((col > 8) && ((col + n) > TERMCAP_MAX_WIDTH)) ++ { ++ fwrite("\\\n\t:", 1, 4, f); ++ col = 8; ++ } ++ fwrite(p, 1, n, f); ++ col += n; ++ p = ++pe; ++ } ++ if(*p) ++ fwrite(p, 1, strlen(p), f); ++ fputc('\n', f); + } + + static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910290423.x9T4NjaT049846>