diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2012-07-29 18:03:50 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2012-07-29 18:26:44 +0200 |
commit | 8700b331b4071c8158be4d6891cb7909859165a9 (patch) | |
tree | 44353e215e598eb756bb6e5456e44ea1571f337e /debian/patches | |
parent | 800542631042fabf3bf0579c6af5de4da2a3ec5b (diff) | |
download | screen-8700b331b4071c8158be4d6891cb7909859165a9.tar.gz |
Patch to add 4.0.3 interoperability.
Thanks Julien Cristau!
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/60-644788-screen-4.1.0-4.0.3-interoperability.patch | 143 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 144 insertions, 0 deletions
diff --git a/debian/patches/60-644788-screen-4.1.0-4.0.3-interoperability.patch b/debian/patches/60-644788-screen-4.1.0-4.0.3-interoperability.patch new file mode 100644 index 0000000..4b3e126 --- /dev/null +++ b/debian/patches/60-644788-screen-4.1.0-4.0.3-interoperability.patch @@ -0,0 +1,143 @@ +Author: Julien Cristau <jcristau@debian.org> +Debian-Bug: #644788 + +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-4.1.0~20120320gitdb59704/screen.h +--- screen-4.1.0~20120320gitdb59704.orig/screen.h ++++ screen-4.1.0~20120320gitdb59704/screen.h +@@ -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-4.1.0~20120320gitdb59704/socket.c +--- screen-4.1.0~20120320gitdb59704.orig/socket.c ++++ screen-4.1.0~20120320gitdb59704/socket.c +@@ -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-4.1.0~20120320gitdb59704/attacher.c +--- screen-4.1.0~20120320gitdb59704.orig/attacher.c ++++ screen-4.1.0~20120320gitdb59704/attacher.c +@@ -133,6 +133,46 @@ 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) ++ { ++ 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 +437,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)) diff --git a/debian/patches/series b/debian/patches/series index 1718780..d7ef1c0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -26,5 +26,6 @@ 53fix-startup-race-condition.patch 58-show-encoding-hardstatus.patch 59-fix-manpage-warnings.patch +60-644788-screen-4.1.0-4.0.3-interoperability.patch # 80-99: experimental patches, new features etc. 80EXP_session_creation_time.patch |