From 42f124647be83797a95fa956bdada69805edbd4d Mon Sep 17 00:00:00 2001
From: Zach van Rijn <me@zv.io>
Date: Thu, 9 Feb 2023 06:03:23 +0000
Subject: system/libuv: apply upstream tty size patch. actually fixes #695.

---
 system/libuv/APKBUILD                           |  4 ++--
 system/libuv/fix-test-terminal-illness.patch    | 27 -----------------------
 system/libuv/fix-test-tty-size-assumption.patch | 29 +++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 29 deletions(-)
 delete mode 100644 system/libuv/fix-test-terminal-illness.patch
 create mode 100644 system/libuv/fix-test-tty-size-assumption.patch

(limited to 'system')

diff --git a/system/libuv/APKBUILD b/system/libuv/APKBUILD
index 89323e26b..599ede9a2 100644
--- a/system/libuv/APKBUILD
+++ b/system/libuv/APKBUILD
@@ -11,7 +11,7 @@ license="MIT AND BSD-2-Clause AND BSD-3-Clause AND ISC"
 makedepends="automake autoconf libtool linux-headers"
 subpackages="$pkgname-dev"
 source="https://dist.libuv.org/dist/v$pkgver/$pkgname-v$pkgver.tar.gz
-	fix-test-terminal-illness.patch
+	fix-test-tty-size-assumption.patch
 	"
 builddir="$srcdir/$pkgname-v$pkgver"
 
@@ -42,4 +42,4 @@ package() {
 }
 
 sha512sums="b4f8944e2c79e3a6a31ded6cccbe4c0eeada50db6bc8a448d7015642795012a4b80ffeef7ca455bb093c59a8950d0e1430566c3c2fa87b73f82699098162d834  libuv-v1.44.1.tar.gz
-46e861417f17a6a423b0d89204d74668c44e96666b69726064799f86b5db2436cfe749619af4c4e1baee8154780738c1eb8892c2a5187f7f46f3c54192b6d749  fix-test-terminal-illness.patch"
+e7b2242345af697dd175a5fc29b7eb001e5b0f43743a86d9e3fc7307cf3b3bb98e46c2993e84332ecb2934a30f942a78f4ddd19efed6871d85fcf8e2bba15643  fix-test-tty-size-assumption.patch"
diff --git a/system/libuv/fix-test-terminal-illness.patch b/system/libuv/fix-test-terminal-illness.patch
deleted file mode 100644
index 85efd77d9..000000000
--- a/system/libuv/fix-test-terminal-illness.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-This patch addresses the following issue:
-
-    https://git.adelielinux.org/adelie/packages/-/issues/695
-
-I've run into this enough times to justify this patch, waking
-up in the morning to find that my overnight builds failed, or
-during manual testing on laptops with smaller displays that
-have a reduce line count when I connect to tmux.
-
-I don't think width is an issue, but saying "you must be 10
-columns or higher to ride" is arbitrarily restrictive.
-
---- a/test/test-tty.c
-+++ b/test/test-tty.c
-@@ -118,10 +118,10 @@
- 
-   /*
-    * Is it a safe assumption that most people have terminals larger than
--   * 10x10?
-+   * 10x10? -- No; you know what they say about assumptions.
-    */
-   ASSERT(width > 10);
--  ASSERT(height > 10);
-+  ASSERT(height > 3);
- 
-   /* Turn on raw mode. */
-   r = uv_tty_set_mode(&tty_in, UV_TTY_MODE_RAW);
diff --git a/system/libuv/fix-test-tty-size-assumption.patch b/system/libuv/fix-test-tty-size-assumption.patch
new file mode 100644
index 000000000..7f1f7cff2
--- /dev/null
+++ b/system/libuv/fix-test-tty-size-assumption.patch
@@ -0,0 +1,29 @@
+From f2aeea78510758053e1634bb6ea6268edfefed51 Mon Sep 17 00:00:00 2001
+From: Ben Noordhuis <info@bnoordhuis.nl>
+Date: Tue, 31 Jan 2023 12:24:58 +0100
+Subject: [PATCH] test: remove bad tty window size assumption
+
+Fixes: https://github.com/libuv/libuv/issues/3894
+---
+ test/test-tty.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/test/test-tty.c b/test/test-tty.c
+index 2c7ec4ec56..f53a701fce 100644
+--- a/test/test-tty.c
++++ b/test/test-tty.c
+@@ -116,12 +116,8 @@ TEST_IMPL(tty) {
+     return TEST_SKIP;
+   }
+ 
+-  /*
+-   * Is it a safe assumption that most people have terminals larger than
+-   * 10x10?
+-   */
+-  ASSERT(width > 10);
+-  ASSERT(height > 10);
++  ASSERT_GT(width, 0);
++  ASSERT_GT(height, 0);
+ 
+   /* Turn on raw mode. */
+   r = uv_tty_set_mode(&tty_in, UV_TTY_MODE_RAW);
-- 
cgit v1.2.3-70-g09d2