[packages/screen] - rel 2; switch back to fifos (like in screen 4.0); add backward compat patch that allows to reattac
arekm
arekm at pld-linux.org
Wed Dec 12 21:08:52 CET 2012
commit 86ec8038ae458a355afaaf03ac44cb7579484256
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Dec 12 21:08:48 2012 +0100
- rel 2; switch back to fifos (like in screen 4.0); add backward compat patch that allows to reattach to 4.0 fifos (all patches from debian)
49long-usernames.patch | 104 ++++++++++++++
50increase-max-TERM-length.patch | 40 ++++++
51fix-utf8-status-padding-bug.patch | 65 +++++++++
52fix_screen_utf8_nfd.patch | 41 ++++++
53fix-startup-race-condition.patch | 15 ++
...44788-screen-4.1.0-4.0.3-interoperability.patch | 151 +++++++++++++++++++++
screen.spec | 20 ++-
7 files changed, 430 insertions(+), 6 deletions(-)
---
diff --git a/screen.spec b/screen.spec
index 0ae53f8..cc2c43d 100644
--- a/screen.spec
+++ b/screen.spec
@@ -1,12 +1,8 @@
#
# Conditional build:
-%bcond_with fifo # force using fifos even if sockets detected
+%bcond_without fifo # force using fifos even if sockets detected
# TODO
-# - should we switch back fifos forcibly (so you could resume 4.0 sessions with 4.1?, stalled for me anyway)
-# configure: checking socket implementation...
-# - you are normal
-# - both sockets and fifos usable. let's take sockets.
# - from changelog: 'maxwin' can now be used to increase the number of maximum windows.
Summary: Screen - Manages multiple sessions on one tty
Summary(de.UTF-8): Screen - Verwaltet mehrere Sitzungen an einem tty
@@ -20,7 +16,7 @@ Summary(uk.UTF-8): Менеджер екрану, що підтримує кіл
Name: screen
# 4.0 stable is on SCREEN_4_0 brach
Version: 4.1.0
-Release: 1.5
+Release: 2
License: GPL v3+
Group: Applications/Terminal
Source0: http://git.savannah.gnu.org/cgit/screen.git/snapshot/%{name}-cbaa666d4f21988164068a38ac915f8b4f3c4da3.tar.gz
@@ -46,6 +42,12 @@ Patch15: %{name}-statusline-encoding.patch
Patch16: screen-ipv6.patch
Patch17: screen-E3.patch
Patch18: screen-4.1.0-suppress_remap.patch
+Patch19: 49long-usernames.patch
+Patch20: 50increase-max-TERM-length.patch
+Patch21: 51fix-utf8-status-padding-bug.patch
+Patch22: 52fix_screen_utf8_nfd.patch
+Patch23: 53fix-startup-race-condition.patch
+Patch24: 60-644788-screen-4.1.0-4.0.3-interoperability.patch
URL: http://www.gnu.org/software/screen/
BuildRequires: autoconf
BuildRequires: automake
@@ -134,6 +136,12 @@ mv screen-*/src/* .
%patch16 -p2
%patch17 -p2
%patch18 -p1
+%patch19 -p1
+%patch20 -p1
+%patch21 -p1
+%patch22 -p1
+%patch23 -p1
+%patch24 -p1
%build
%{__aclocal}
diff --git a/49long-usernames.patch b/49long-usernames.patch
new file mode 100644
index 0000000..58ce4f6
--- /dev/null
+++ b/49long-usernames.patch
@@ -0,0 +1,104 @@
+Description: Patch to allow usernames longer than 20 characters.
+Source: http://www.mail-archive.com/screen-devel@gnu.org/msg00186.html
+Author: Steve Kemp
+Upstream-Bug: http://savannah.gnu.org/bugs/?21653
+Debian-Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560231
+Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/screen/+bug/582153
+
+Index: screen/acconfig.h
+===================================================================
+--- screen.orig/acconfig.h 2011-10-08 21:20:48.000000000 +0200
++++ screen/acconfig.h 2011-10-08 21:20:57.000000000 +0200
+@@ -39,6 +39,13 @@
+ #endif
+
+ /*
++ * Length of longest username.
++ */
++#ifndef MAX_USERNAME_LEN
++# define MAX_USERNAME_LEN 50
++#endif
++
++/*
+ * Define SOCKDIR to be the directory to contain the named sockets
+ * screen creates. This should be in a common subdirectory, such as
+ * /usr/local or /tmp. It makes things a little more secure if you
+Index: screen/acls.c
+===================================================================
+--- screen.orig/acls.c 2011-10-08 21:20:48.000000000 +0200
++++ screen/acls.c 2011-10-08 21:20:57.000000000 +0200
+@@ -182,7 +182,7 @@
+ #endif
+ (*up)->u_Esc = DefaultEsc;
+ (*up)->u_MetaEsc = DefaultMetaEsc;
+- strncpy((*up)->u_name, name, 20);
++ strncpy((*up)->u_name, name, MAX_USERNAME_LEN);
+ (*up)->u_password = NULL;
+ if (pass)
+ (*up)->u_password = SaveStr(pass);
+@@ -318,8 +318,8 @@
+ return UserAdd(name, pass, up);
+ if (!strcmp(name, "nobody")) /* he remains without password */
+ return -1;
+- strncpy((*up)->u_password, pass ? pass : "", 20);
+- (*up)->u_password[20] = '\0';
++ strncpy((*up)->u_password, pass ? pass : "", MAX_USERNAME_LEN);
++ (*up)->u_password[MAX_USERNAME_LEN] = '\0';
+ return 0;
+ }
+ #endif
+Index: screen/acls.h
+===================================================================
+--- screen.orig/acls.h 2011-10-08 21:20:48.000000000 +0200
++++ screen/acls.h 2011-10-08 21:20:57.000000000 +0200
+@@ -78,7 +78,7 @@
+ typedef struct acluser
+ {
+ struct acluser *u_next; /* continue the main user list */
+- char u_name[20+1]; /* login name how he showed up */
++ char u_name[MAX_USERNAME_LEN+1]; /* login name how he showed up */
+ char *u_password; /* his password (may be NullStr). */
+ int u_checkpassword; /* nonzero if this u_password is valid */
+ int u_detachwin; /* the window where he last detached */
+Index: screen/screen.c
+===================================================================
+--- screen.orig/screen.c 2011-10-08 21:20:56.000000000 +0200
++++ screen/screen.c 2011-10-08 21:20:57.000000000 +0200
+@@ -997,7 +997,7 @@
+
+ if (home == 0 || *home == '\0')
+ home = ppp->pw_dir;
+- if (strlen(LoginName) > 20)
++ if (strlen(LoginName) > MAX_USERNAME_LEN)
+ Panic(0, "LoginName too long - sorry.");
+ #ifdef MULTIUSER
+ if (multi && strlen(multi) > 20)
+Index: screen/screen.h
+===================================================================
+--- screen.orig/screen.h 2011-10-08 21:20:48.000000000 +0200
++++ screen/screen.h 2011-10-08 21:20:57.000000000 +0200
+@@ -207,7 +207,7 @@
+ create;
+ struct
+ {
+- char auser[20 + 1]; /* username */
++ char auser[MAX_USERNAME_LEN + 1]; /* username */
+ int apid; /* pid of frontend */
+ int adaptflag; /* adapt window size? */
+ int lines, columns; /* display size */
+@@ -221,13 +221,13 @@
+ attach;
+ struct
+ {
+- char duser[20 + 1]; /* username */
++ char duser[MAX_USERNAME_LEN + 1]; /* username */
+ int dpid; /* pid of frontend */
+ }
+ detach;
+ struct
+ {
+- char auser[20 + 1]; /* username */
++ char auser[MAX_USERNAME_LEN + 1]; /* username */
+ int nargs;
+ char cmd[MAXPATHLEN]; /* command */
+ int apid; /* pid of frontend */
diff --git a/50increase-max-TERM-length.patch b/50increase-max-TERM-length.patch
new file mode 100644
index 0000000..5a138b7
--- /dev/null
+++ b/50increase-max-TERM-length.patch
@@ -0,0 +1,40 @@
+From: Andy Spencer
+Subject: [screen-devel] [PATCH 1/1] Increase max TERM length to 40 characters
+Date: Tue, 5 Apr 2011 03:26:58 +0000
+Source: https://lists.gnu.org/archive/html/screen-devel/2011-04/msg00002.html
+
+Some terms contain rather long TERM names these days, for example,
+`rxvt-unicode-256color'. Increasing the max size for the TERM variables
+avoids the `$TERM too long - sorry.' error when using these terms.
+
+---
+ display.h | 2 +-
+ screen.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: screen/display.h
+===================================================================
+--- screen.orig/display.h 2011-10-06 01:30:53.000000000 +0200
++++ screen/display.h 2011-10-08 21:28:51.000000000 +0200
+@@ -73,7 +73,7 @@
+ struct win *d_other; /* pointer to other window */
+ int d_nonblock; /* -1 don't block if obufmax reached */
+ /* >0: block after nonblock secs */
+- char d_termname[20 + 1]; /* $TERM */
++ char d_termname[40 + 1]; /* $TERM */
+ char *d_tentry; /* buffer for tgetstr */
+ char d_tcinited; /* termcap inited flag */
+ int d_width, d_height; /* width/height of the screen */
+Index: screen/screen.h
+===================================================================
+--- screen.orig/screen.h 2011-10-08 21:20:57.000000000 +0200
++++ screen/screen.h 2011-10-08 21:28:45.000000000 +0200
+@@ -214,7 +214,7 @@
+ char preselect[20];
+ int esc; /* his new escape character unless -1 */
+ int meta_esc; /* his new meta esc character unless -1 */
+- char envterm[20 + 1]; /* terminal type */
++ char envterm[40 + 1]; /* terminal type */
+ int encoding; /* encoding of display */
+ int detachfirst; /* whether to detach remote sessions first */
+ }
diff --git a/51fix-utf8-status-padding-bug.patch b/51fix-utf8-status-padding-bug.patch
new file mode 100644
index 0000000..0254492
--- /dev/null
+++ b/51fix-utf8-status-padding-bug.patch
@@ -0,0 +1,65 @@
+fix-utf8-status-padding-bug
+
+Ensure that multibyte UTF8 characters are counted correctly when
+calculating and displaying the caption and hardstatus lines.
+
+Based on an earlier version by Kees Cook <address at hidden>
+
+Signed-off-by: Dustin Kirkland <address at hidden>
+
+=== modified file 'src/display.c'
+Index: screen/display.c
+===================================================================
+--- screen.orig/display.c 2012-03-20 22:15:02.000000000 +0100
++++ screen/display.c 2012-03-20 22:41:28.000000000 +0100
+@@ -2155,7 +2155,7 @@
+ {
+ int chars = strlen_onscreen((unsigned char *)(s + start), (unsigned char *)(s + max));
+ D_encoding = 0;
+- PutWinMsg(s, start, max);
++ PutWinMsg(s, start, max + ((max - start) - chars)); /* Multibyte count */
+ D_encoding = UTF8;
+ D_x -= (max - chars); /* Yak! But this is necessary to count for
+ the fact that not every byte represents a
+@@ -2249,11 +2249,15 @@
+ RefreshHStatus()
+ {
+ char *buf;
+-
++#ifdef UTF8
++ int extrabytes = strlen(hstatusstring) - strlen_onscreen(hstatusstring, NULL);
++#else
++ int extrabytes = 0;
++#endif
+ evdeq(&D_hstatusev);
+ if (D_status == STATUS_ON_HS)
+ return;
+- buf = MakeWinMsgEv(hstatusstring, D_fore, '%', (D_HS && D_has_hstatus == HSTATUS_HS && D_WS > 0) ? D_WS : D_width - !D_CLP, &D_hstatusev, 0);
++ buf = MakeWinMsgEv(hstatusstring, D_fore, '%', (D_HS && D_has_hstatus == HSTATUS_HS && D_WS > 0) ? D_WS : D_width - !D_CLP + extrabytes, &D_hstatusev, 0);
+ if (buf && *buf)
+ {
+ ShowHStatus(buf);
+@@ -2348,8 +2352,13 @@
+ {
+ if (y == cv->c_ye + 1 && from >= cv->c_xs && from <= cv->c_xe)
+ {
++#ifdef UTF8
++ int extrabytes = strlen(captionstring) - strlen_onscreen(captionstring, NULL);
++#else
++ int extrabytes = 0;
++#endif
+ p = Layer2Window(cv->c_layer);
+- buf = MakeWinMsgEv(captionstring, p, '%', cv->c_xe - cv->c_xs + (cv->c_xe + 1 < D_width || D_CLP), &cv->c_captev, 0);
++ buf = MakeWinMsgEv(captionstring, p, '%', cv->c_xe - cv->c_xs + (cv->c_xe + 1 < D_width || D_CLP) + extrabytes, &cv->c_captev, 0);
+ if (cv->c_captev.timeout.tv_sec)
+ evenq(&cv->c_captev);
+ xx = to > cv->c_xe ? cv->c_xe : to;
+@@ -2358,7 +2367,7 @@
+ SetRendition(&mchar_so);
+ if (l > xx - cv->c_xs + 1)
+ l = xx - cv->c_xs + 1;
+- l = PrePutWinMsg(buf, from - cv->c_xs, l);
++ l = PrePutWinMsg(buf, from - cv->c_xs, l + extrabytes);
+ from = cv->c_xs + l;
+ for (; from <= xx; from++)
+ PUTCHARLP(' ');
diff --git a/52fix_screen_utf8_nfd.patch b/52fix_screen_utf8_nfd.patch
new file mode 100644
index 0000000..0aa72d5
--- /dev/null
+++ b/52fix_screen_utf8_nfd.patch
@@ -0,0 +1,41 @@
+## 52fix_screen_utf8_nfd.dpatch by Nobuhiro Iwamatsu <iwamatsu at debian.org>
+##
+## DP: screen outputs screen "ÿ" after a connected character.
+## DP: This is a character without the need.
+## DP: This happens in UTF-8 environment.
+## DP: Before : screen$ ruby1.9.1 -e 'puts "\u304b\u3099.."'
+## DP: がÿ...
+## DP: patch applied : screen $ ruby1.9.1 -e 'puts "\u304b\u3099.."'
+## DP: が..
+## DP: Report from http://d.hatena.ne.jp/mrkn/20101014/fix_screen_utf8_nfd_bug
+## DP: Copyright Kenta Murata (mrkn) <mrkn at ruby-lang.org>
+## DP: Modified by Nobuhiro Iwamatsu <iwamatsu at debian.org>
+
+Index: screen/ansi.c
+===================================================================
+--- screen.orig/ansi.c 2012-03-20 22:15:02.000000000 +0100
++++ screen/ansi.c 2012-03-20 22:41:45.000000000 +0100
+@@ -725,6 +725,10 @@
+ LPutChar(&curr->w_layer, &omc, ox, oy);
+ LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
+ }
++ if (curr->w_mbcs)
++ {
++ curr->w_rend.mbcs = curr->w_mbcs = 0;
++ }
+ break;
+ }
+ font = curr->w_rend.font;
+Index: screen/display.c
+===================================================================
+--- screen.orig/display.c 2012-03-20 22:41:28.000000000 +0100
++++ screen/display.c 2012-03-20 22:41:45.000000000 +0100
+@@ -603,7 +603,7 @@
+ D_x += D_AM ? 1 : -1;
+ D_mbcs = 0;
+ }
+- else if (utf8_isdouble(c))
++ else if (utf8_isdouble(c) || (c >= 0xd800 && c < 0xe000))
+ {
+ D_mbcs = c;
+ D_x++;
diff --git a/53fix-startup-race-condition.patch b/53fix-startup-race-condition.patch
new file mode 100644
index 0000000..c5bf1ab
--- /dev/null
+++ b/53fix-startup-race-condition.patch
@@ -0,0 +1,15 @@
+Fixes directory creation race condition (#653434)
+
+Index: screen/screen.c
+===================================================================
+--- screen.orig/screen.c 2012-06-21 01:43:09.000000000 +0200
++++ screen/screen.c 2012-06-21 01:44:31.000000000 +0200
+@@ -1127,7 +1127,7 @@
+ sprintf(SockPath, "%s/S-%s", SockDir, LoginName);
+ if (access(SockPath, F_OK))
+ {
+- if (mkdir(SockPath, 0700) == -1)
++ if (mkdir(SockPath, 0700) == -1 && errno != EEXIST)
+ Panic(errno, "Cannot make directory '%s'", SockPath);
+ (void) chown(SockPath, real_uid, real_gid);
+ }
diff --git a/60-644788-screen-4.1.0-4.0.3-interoperability.patch b/60-644788-screen-4.1.0-4.0.3-interoperability.patch
new file mode 100644
index 0000000..1632986
--- /dev/null
+++ b/60-644788-screen-4.1.0-4.0.3-interoperability.patch
@@ -0,0 +1,151 @@
+Author: Julien Cristau <jcristau at debian.org>
+Debian-Bug: #644788
+
+Author: Axel Beckert <abe at debian.org>
+Debian-Bug: #684342
+
+The following patch, while not all that pretty, seems to allow me to
+attach to a screen started with either the squeeze or sid version.
+I'm sure there's corner cases, but.
+
+Cheers,
+Julien
+
+Index: screen/screen.h
+===================================================================
+--- screen.orig/screen.h 2012-08-09 01:01:28.000000000 +0200
++++ screen/screen.h 2012-08-09 01:01:28.000000000 +0200
+@@ -240,6 +240,57 @@ struct msg
+ } m;
+ };
+
++struct old_msg
++{
++ int protocol_revision; /* reduce harm done by incompatible messages */
++ int type;
++ char m_tty[MAXPATHLEN]; /* ttyname */
++ union
++ {
++ struct
++ {
++ int lflag;
++ int aflag;
++ int flowflag;
++ int hheight; /* size of scrollback buffer */
++ int nargs;
++ char line[MAXPATHLEN];
++ char dir[MAXPATHLEN];
++ char screenterm[20]; /* is screen really "screen" ? */
++ }
++ create;
++ struct
++ {
++ char auser[20 + 1]; /* username */
++ int apid; /* pid of frontend */
++ int adaptflag; /* adapt window size? */
++ int lines, columns; /* display size */
++ char preselect[20];
++ int esc; /* his new escape character unless -1 */
++ int meta_esc; /* his new meta esc character unless -1 */
++ char envterm[20 + 1]; /* terminal type */
++ int encoding; /* encoding of display */
++ }
++ attach;
++ struct
++ {
++ char duser[20 + 1]; /* username */
++ int dpid; /* pid of frontend */
++ }
++ detach;
++ struct
++ {
++ char auser[20 + 1]; /* username */
++ int nargs;
++ char cmd[MAXPATHLEN]; /* command */
++ int apid; /* pid of frontend */
++ char preselect[20];
++ }
++ command;
++ char message[MAXPATHLEN * 2];
++ } m;
++};
++
+ /*
+ * And the signals the attacher receives from the backend
+ */
+Index: screen/socket.c
+===================================================================
+--- screen.orig/socket.c 2012-08-09 01:01:28.000000000 +0200
++++ screen/socket.c 2012-08-09 01:01:29.000000000 +0200
+@@ -1067,7 +1067,9 @@ ReceiveMsg()
+ }
+ if (left > 0)
+ {
+- if (left != sizeof(m))
++ if (left == sizeof(struct msg) - sizeof(struct old_msg))
++ ;/* old format message, ignore */
++ else if (left != sizeof(m))
+ Msg(0, "Message %d of %d bytes too small", left, (int)sizeof(m));
+ else
+ debug("No data on socket.\n");
+Index: screen/attacher.c
+===================================================================
+--- screen.orig/attacher.c 2012-08-09 01:01:28.000000000 +0200
++++ screen/attacher.c 2012-08-09 01:32:08.000000000 +0200
+@@ -133,6 +133,48 @@ struct msg *m;
+ return 0;
+ }
+
++int
++WriteOldMessage(struct msg *m)
++{
++ sleep(1); /* give the server some time to reopen the pipe */
++ if (m->type == MSG_ATTACH && (m->m.attach.detachfirst == MSG_ATTACH ||
++ m->m.attach.detachfirst == MSG_DETACH ||
++ m->m.attach.detachfirst == MSG_POW_DETACH))
++ {
++ struct old_msg old_m;
++ int s;
++ int r, l = sizeof(old_m);
++
++ s = MakeClientSocket(0);
++ if (s < 0)
++ return 0;
++ old_m.protocol_revision = (('m'<<24) | ('s'<<16) | ('g'<<8) | 0);
++ old_m.type = m->type;
++ memcpy(old_m.m_tty, m->m_tty, sizeof(old_m.m_tty));
++ memcpy(old_m.m.attach.auser, m->m.attach.auser, sizeof(old_m.m.attach.auser));
++ old_m.m.attach.apid = m->m.attach.apid;
++ old_m.m.attach.adaptflag = m->m.attach.adaptflag;
++ old_m.m.attach.lines = m->m.attach.lines;
++ old_m.m.attach.columns = m->m.attach.columns;
++ memcpy(old_m.m.attach.preselect, m->m.attach.preselect, sizeof(old_m.m.attach.preselect));
++ old_m.m.attach.esc = m->m.attach.esc;
++ old_m.m.attach.meta_esc = m->m.attach.meta_esc;
++ memcpy(old_m.m.attach.envterm, m->m.attach.envterm, sizeof(old_m.m.attach.envterm));
++ old_m.m.attach.encoding = m->m.attach.encoding;
++ while(l > 0)
++ {
++ r = write(s, (char *)&old_m + (sizeof(struct old_msg) - l), l);
++ if (r == -1 && errno == EINTR)
++ continue;
++ if (r == -1 || r == 0)
++ return -1;
++ l -= r;
++ }
++ close(s);
++ }
++ return 0;
++}
++
+
+ int
+ Attach(how)
+@@ -397,6 +439,7 @@ int how;
+ if (WriteMessage(lasts, &m))
+ Panic(errno, "WriteMessage");
+ close(lasts);
++ WriteOldMessage(&m);
+ debug1("Attach(%d): sent\n", m.type);
+ #ifdef MULTIUSER
+ if (multi && (how == MSG_ATTACH || how == MSG_CONT))
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/screen.git/commitdiff/86ec8038ae458a355afaaf03ac44cb7579484256
More information about the pld-cvs-commit
mailing list