diff --git a/srcpkgs/abduco/patches/0001-Use-fixed-size-integer-types-in-protocol-messages.patch b/srcpkgs/abduco/patches/0001-Use-fixed-size-integer-types-in-protocol-messages.patch new file mode 100644 index 00000000000..ad4476863e0 --- /dev/null +++ b/srcpkgs/abduco/patches/0001-Use-fixed-size-integer-types-in-protocol-messages.patch @@ -0,0 +1,105 @@ +From 90414320c7d3fbfa64642d8039bead632b2bed1e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= +Date: Wed, 21 Jun 2017 22:37:43 +0200 +Subject: [PATCH 1/4] Use fixed size integer types in protocol messages + +This should make it possible to connect with a 32bit client to a 64bit +server. This might also make it possible to forward the abduco socket +over SSH as described in #25. Different endianness are not supported at +this time. + +This is a breaking protocol change. Make sure to use the same version +as client and server (anything else is unsupported anyway!). +--- + abduco.c | 12 ++++++++---- + client.c | 2 +- + debug.c | 4 ++-- + server.c | 5 ++++- + 4 files changed, 15 insertions(+), 8 deletions(-) + +diff --git abduco.c abduco.c +index 3c60a36..1bd6304 100644 +--- abduco.c ++++ abduco.c +@@ -15,6 +15,7 @@ + */ + #include + #include ++#include + #include + #include + #include +@@ -71,12 +72,15 @@ enum PacketType { + }; + + typedef struct { +- unsigned int type; +- size_t len; ++ uint32_t type; ++ uint32_t len; + union { + char msg[BUFSIZ]; +- struct winsize ws; +- int i; ++ struct { ++ uint16_t rows; ++ uint16_t cols; ++ } ws; ++ uint32_t i; + } u; + } Packet; + +diff --git client.c client.c +index 744f061..2c2192b 100644 +--- client.c ++++ client.c +@@ -78,7 +78,7 @@ static int client_mainloop(void) { + if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) { + Packet pkt = { + .type = MSG_RESIZE, +- .u = { .ws = ws }, ++ .u = { .ws = { .rows = ws.ws_row, .cols = ws.ws_col } }, + .len = sizeof(ws), + }; + if (client_send_packet(&pkt)) +diff --git debug.c debug.c +index b5748ab..e904e33 100644 +--- debug.c ++++ debug.c +@@ -29,7 +29,7 @@ static void print_packet(const char *prefix, Packet *pkt) { + fwrite(pkt->u.msg, pkt->len, 1, stderr); + break; + case MSG_RESIZE: +- fprintf(stderr, "%dx%d", pkt->u.ws.ws_col, pkt->u.ws.ws_row); ++ fprintf(stderr, "%"PRIu16"x%"PRIu16, pkt->u.ws.cols, pkt->u.ws.rows); + break; + case MSG_ATTACH: + fprintf(stderr, "readonly: %d low-priority: %d", +@@ -37,7 +37,7 @@ static void print_packet(const char *prefix, Packet *pkt) { + pkt->u.i & CLIENT_LOWPRIORITY); + break; + default: +- fprintf(stderr, "len: %zu", pkt->len); ++ fprintf(stderr, "len: %"PRIu32, pkt->len); + break; + } + fprintf(stderr, "\n"); +diff --git server.c server.c +index 78ccbe2..6f62cfb 100644 +--- server.c ++++ server.c +@@ -224,7 +224,10 @@ static void server_mainloop(void) { + case MSG_REDRAW: + if (!(c->flags & CLIENT_READONLY) && (client_packet.type == MSG_REDRAW || c == server.clients)) { + debug("server-ioct: TIOCSWINSZ\n"); +- ioctl(server.pty, TIOCSWINSZ, &client_packet.u.ws); ++ struct winsize ws = { 0 }; ++ ws.ws_row = client_packet.u.ws.rows; ++ ws.ws_col = client_packet.u.ws.cols; ++ ioctl(server.pty, TIOCSWINSZ, &ws); + } + kill(-server.pid, SIGWINCH); + break; +-- +2.24.0 + diff --git a/srcpkgs/abduco/patches/0002-Fix-length-of-MSG_RESIZE-packet.patch b/srcpkgs/abduco/patches/0002-Fix-length-of-MSG_RESIZE-packet.patch new file mode 100644 index 00000000000..1e7dde3c4c6 --- /dev/null +++ b/srcpkgs/abduco/patches/0002-Fix-length-of-MSG_RESIZE-packet.patch @@ -0,0 +1,26 @@ +From c840155f209a67b16d2c8a0283542d636192576a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= +Date: Tue, 27 Jun 2017 08:49:22 +0200 +Subject: [PATCH 2/4] Fix length of MSG_RESIZE packet + +We no longer send the complete struct winsize. +--- + client.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git client.c client.c +index 2c2192b..f26bc8f 100644 +--- client.c ++++ client.c +@@ -79,7 +79,7 @@ static int client_mainloop(void) { + Packet pkt = { + .type = MSG_RESIZE, + .u = { .ws = { .rows = ws.ws_row, .cols = ws.ws_col } }, +- .len = sizeof(ws), ++ .len = sizeof(pkt.u.ws), + }; + if (client_send_packet(&pkt)) + client.need_resize = false; +-- +2.24.0 + diff --git a/srcpkgs/abduco/patches/0003-Avoid-use-of-BUFSIZ-to-guarantee-system-independent-.patch b/srcpkgs/abduco/patches/0003-Avoid-use-of-BUFSIZ-to-guarantee-system-independent-.patch new file mode 100644 index 00000000000..3bf277098ec --- /dev/null +++ b/srcpkgs/abduco/patches/0003-Avoid-use-of-BUFSIZ-to-guarantee-system-independent-.patch @@ -0,0 +1,26 @@ +From c3c115deab4562af72be43832aaecbd8accba51a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= +Date: Tue, 27 Jun 2017 08:50:10 +0200 +Subject: [PATCH 3/4] Avoid use of BUFSIZ to guarantee system independent + package size + +--- + abduco.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git abduco.c abduco.c +index 1bd6304..335907d 100644 +--- abduco.c ++++ abduco.c +@@ -75,7 +75,7 @@ typedef struct { + uint32_t type; + uint32_t len; + union { +- char msg[BUFSIZ]; ++ char msg[4096 - 2*sizeof(uint32_t)]; + struct { + uint16_t rows; + uint16_t cols; +-- +2.24.0 + diff --git a/srcpkgs/abduco/patches/0004-Correct-EOF-handling-on-client-stdin.patch b/srcpkgs/abduco/patches/0004-Correct-EOF-handling-on-client-stdin.patch new file mode 100644 index 00000000000..75ba5c44c30 --- /dev/null +++ b/srcpkgs/abduco/patches/0004-Correct-EOF-handling-on-client-stdin.patch @@ -0,0 +1,28 @@ +From 98e293c54aa08cbee14674c82159d851bd8b9d56 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= +Date: Sat, 17 Mar 2018 10:32:40 +0100 +Subject: [PATCH 4/4] Correct EOF handling on client stdin + +Previously we would end in an infinite loop which might be the cause +of #15. +--- + client.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git client.c client.c +index f26bc8f..6cf70c7 100644 +--- client.c ++++ client.c +@@ -129,6 +129,9 @@ static int client_mainloop(void) { + } else if (!(client.flags & CLIENT_READONLY)) { + client_send_packet(&pkt); + } ++ } else if (len == 0) { ++ debug("client-stdin: EOF\n"); ++ return -1; + } + } + } +-- +2.24.0 + diff --git a/srcpkgs/abduco/template b/srcpkgs/abduco/template index f001c1202da..21fa18ce85a 100644 --- a/srcpkgs/abduco/template +++ b/srcpkgs/abduco/template @@ -1,8 +1,9 @@ # Template file for 'abduco' pkgname=abduco version=0.6 -revision=1 +revision=2 build_style=gnu-makefile +make_use_env=yes short_desc="Session management in a clean and simple way" maintainer="Orphaned " license="ISC" @@ -10,10 +11,6 @@ homepage="http://www.brain-dump.org/projects/abduco/" distfiles="http://www.brain-dump.org/projects/${pkgname}/${pkgname}-${version}.tar.gz" checksum=c90909e13fa95770b5afc3b59f311b3d3d2fdfae23f9569fa4f96a3e192a35f4 -do_build() { - make CC="$CC" -} - post_install() { vlicense LICENSE }