summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCeleste <20312-Celeste@users.gitlab.alpinelinux.org>2023-12-14 08:00:36 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2023-12-15 09:03:26 +0000
commit007db777f10df10beed5d39cc127cab589e1cc29 (patch)
tree29ad417c68cc33dd232f85b6b20f8233fd6b56a0
parente2512977b0a9da1cd1c3fe73c598fdbc2f21e2c5 (diff)
downloadaports-007db777f10df10beed5d39cc127cab589e1cc29.zip
main/readline: upgrade to 8.2.7
- Update license - Fix typos - Import patch from Debian to fix double free when using Page Down (steps to reproduce, tried in bash: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1056314)
-rw-r--r--main/readline/APKBUILD16
-rw-r--r--main/readline/fix-rl_do_undo-crash.patch127
2 files changed, 139 insertions, 4 deletions
diff --git a/main/readline/APKBUILD b/main/readline/APKBUILD
index 449352e92d1..2409539db42 100644
--- a/main/readline/APKBUILD
+++ b/main/readline/APKBUILD
@@ -1,17 +1,18 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=readline
-pkgver=8.2.1
-pkgrel=2
+pkgver=8.2.7
+pkgrel=0
_myver=${pkgver%.*}
pkgdesc="GNU readline library"
url="https://tiswww.cwru.edu/php/chet/readline/rltop.html"
arch="all"
options="!check"
-license="GPL-2.0-or-later"
+license="GPL-3.0-or-later"
makedepends_host="ncurses-dev chrpath"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc libhistory"
source="https://ftp.gnu.org/gnu/readline/readline-$_myver.tar.gz
fix-ncurses-underlinking.patch
+ fix-rl_do_undo-crash.patch
inputrc
"
patch_args="-p0" # patchlevel used by upstream patches
@@ -41,7 +42,7 @@ build() {
package() {
make -C "$builddir" DESTDIR="$pkgdir" install
- # verfy that its not underlinked as upstream designed it
+ # verify that it is not underlinked as upstream designed it
if ! readelf -d "$pkgdir"/usr/lib/libreadline.so | grep -q 'NEEDED.*ncurses'; then
error "readline needs to be linked against ncurses"
return 1
@@ -60,6 +61,13 @@ libhistory() {
sha512sums="
0a451d459146bfdeecc9cdd94bda6a6416d3e93abd80885a40b334312f16eb890f8618a27ca26868cebbddf1224983e631b1cbc002c1a4d1cd0d65fba9fea49a readline-8.2.tar.gz
b8e2f9a5c9294b49d35c2e1bbde523f01390dd3c8729f3a78e79799a236515ec723af795ba91b0a662a30e8c31df0f63bc80771e82cd31b4673f41428a5049ae fix-ncurses-underlinking.patch
+ddb9308005996106c4bc369ed5726c2479aeb73287ef30a1dc4d6c54fad78f8b1ea46d89b75bd7b00c54acd0ee0d9d17debf922e2260caea2df212e2f9d5109e fix-rl_do_undo-crash.patch
5dbe872e94166aaed7ca2edec5a34ef9b13b254381e252cc6d851877b461579903cbb5b5dc588eabececcf1ebe636f6cb4da406cd01b64757f8c7e7f62e9a276 inputrc
ea3800a62e992b3e594d78e77b6c4b662fb8c501b81010277e478656bb3b56db7747ba40c6c3d68c3ec5ab8e9e41be104788ec52268135d7e642ff40dea421a8 readline82-001.patch
+2d4058c5c886498486d8514c238c0a05c0a97409011a7da40745e842977f0a29754e8b678f7e6e7a47c00df7e2e4c522d34d473118a24524af3824eed912e74a readline82-002.patch
+796df5a5bc4fc4077158621ac5359a7ccf81261e55880e6e70577ba24b50bd4fce4f2c70521d69a776f6ae8890d14d4f5c95cb9ba7c10f1065978c70626faeab readline82-003.patch
+dc5e4cb6b7a058f433c9c6a587772a4c63e0aeef9c59f45f3f859a007cdbaa46dfd560c43cfe51b9c5c0a3a4d662c100540afc6026b2f8544984867ea3b52661 readline82-004.patch
+f20bcea5ce592edd0e41e0d725611ce536ceffc9ab176511ba6786ae802160b277c412ccbb2ce175da656bdfe5f0fd3f3ace11752cf1a152abff64c90f67a53a readline82-005.patch
+0a2737b2e566fafd60da8c0c7abcbaef24139165fb62a422d257b4cf38835b1e9b7a639c9e64228bbaac432d6a9ce62363b134284e55f3473df788f6433fbe63 readline82-006.patch
+e96dafe28f20b1092af08422b9be99965e3a973a0c19f7c57669a6a7fbf74ad4cc3490fa2ad50a1845644a65b0a0e001cfc7ad29528b3b36827a1b9a2c9a96e7 readline82-007.patch
"
diff --git a/main/readline/fix-rl_do_undo-crash.patch b/main/readline/fix-rl_do_undo-crash.patch
new file mode 100644
index 00000000000..513c8b144a9
--- /dev/null
+++ b/main/readline/fix-rl_do_undo-crash.patch
@@ -0,0 +1,127 @@
+Patch-Source: https://sources.debian.org/data/main/r/readline/8.2-3/debian/patches/fix-rl_do_undo-crash.diff
+
+https://git.savannah.gnu.org/cgit/bash.git/patch/?id=277c21d2b2c6730f6cbda428180b08bacdcecc80
+
+From 277c21d2b2c6730f6cbda428180b08bacdcecc80 Mon Sep 17 00:00:00 2001
+From: Chet Ramey <chet.ramey@case.edu>
+Date: Mon, 6 Mar 2023 10:50:45 -0500
+Subject: readline fix for rl_undo_list pointer aliasing; arith command sets
+ word_top
+
+--- histlib.h
++++ histlib.h
+@@ -1,6 +1,6 @@
+ /* histlib.h -- internal definitions for the history library. */
+
+-/* Copyright (C) 1989-2009,2021-2022 Free Software Foundation, Inc.
++/* Copyright (C) 1989-2009,2021-2023 Free Software Foundation, Inc.
+
+ This file contains the GNU History Library (History), a set of
+ routines for managing the text of previously typed lines.
+@@ -84,6 +84,7 @@ extern int _hs_history_patsearch (const
+
+ /* history.c */
+ extern void _hs_replace_history_data (int, histdata_t *, histdata_t *);
++extern int _hs_search_history_data (histdata_t *);
+ extern int _hs_at_end_of_history (void);
+
+ /* histfile.c */
+--- history.c
++++ history.c
+@@ -1,6 +1,6 @@
+ /* history.c -- standalone history library */
+
+-/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
++/* Copyright (C) 1989-2023 Free Software Foundation, Inc.
+
+ This file contains the GNU History Library (History), a set of
+ routines for managing the text of previously typed lines.
+@@ -460,7 +460,7 @@ _hs_replace_history_data (int which, his
+ }
+
+ last = -1;
+- for (i = 0; i < history_length; i++)
++ for (i = history_length - 1; i >= 0; i--)
+ {
+ entry = the_history[i];
+ if (entry == 0)
+@@ -477,7 +477,27 @@ _hs_replace_history_data (int which, his
+ entry = the_history[last];
+ entry->data = new; /* XXX - we don't check entry->old */
+ }
+-}
++}
++
++int
++_hs_search_history_data (histdata_t *needle)
++{
++ register int i;
++ HIST_ENTRY *entry;
++
++ if (history_length == 0 || the_history == 0)
++ return -1;
++
++ for (i = history_length - 1; i >= 0; i--)
++ {
++ entry = the_history[i];
++ if (entry == 0)
++ continue;
++ if (entry->data == needle)
++ return i;
++ }
++ return -1;
++}
+
+ /* Remove history element WHICH from the history. The removed
+ element is returned to you so you can free the line, data,
+--- misc.c
++++ misc.c
+@@ -339,6 +339,9 @@ rl_maybe_replace_line (void)
+ xfree (temp->line);
+ FREE (temp->timestamp);
+ xfree (temp);
++ /* XXX - what about _rl_saved_line_for_history? if the saved undo list
++ is rl_undo_list, and we just put that into a history entry, should
++ we set the saved undo list to NULL? */
+ }
+ return 0;
+ }
+@@ -386,14 +389,16 @@ _rl_free_saved_history_line (void)
+
+ if (_rl_saved_line_for_history)
+ {
+- if (rl_undo_list && rl_undo_list == (UNDO_LIST *)_rl_saved_line_for_history->data)
+- rl_undo_list = 0;
+- /* Have to free this separately because _rl_free_history entry can't:
+- it doesn't know whether or not this has application data. Only the
+- callers that know this is _rl_saved_line_for_history can know that
+- it's an undo list. */
+- if (_rl_saved_line_for_history->data)
+- _rl_free_undo_list ((UNDO_LIST *)_rl_saved_line_for_history->data);
++ UNDO_LIST *sentinel;
++
++ sentinel = (UNDO_LIST *)_rl_saved_line_for_history->data;
++
++ /* We should only free `data' if it's not the current rl_undo_list and
++ it's not the `data' member in a history entry somewhere. We have to
++ free it separately because only the callers know it's an undo list. */
++ if (sentinel && sentinel != rl_undo_list && _hs_search_history_data ((histdata_t *)sentinel) < 0)
++ _rl_free_undo_list (sentinel);
++
+ _rl_free_history_entry (_rl_saved_line_for_history);
+ _rl_saved_line_for_history = (HIST_ENTRY *)NULL;
+ }
+--- search.c
++++ search.c
+@@ -88,8 +88,10 @@ make_history_line_current (HIST_ENTRY *e
+
+ xlist = _rl_saved_line_for_history ? (UNDO_LIST *)_rl_saved_line_for_history->data : 0;
+ /* At this point, rl_undo_list points to a private search string list. */
+- if (rl_undo_list && rl_undo_list != (UNDO_LIST *)entry->data && rl_undo_list != xlist)
++ if (rl_undo_list && rl_undo_list != (UNDO_LIST *)entry->data && rl_undo_list != xlist &&
++ _hs_search_history_data ((histdata_t *)rl_undo_list) < 0)
+ rl_free_undo_list ();
++ rl_undo_list = 0; /* XXX */
+
+ /* Now we create a new undo list with a single insert for this text.
+ WE DON'T CHANGE THE ORIGINAL HISTORY ENTRY UNDO LIST */