From 851589c282877e90adef071681a4b16cc2d59b2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Fonzo?= Date: Fri, 25 Jan 2019 16:20:23 -0300 Subject: [PATCH] recipes: libs/readline: downgraded to the version 7.0. Some programs are expecting this version rather than recent readline 8.0 --- patches/readline/readline70-001 | 57 ++++++++++++++++++++ patches/readline/readline70-002 | 103 +++++++++++++++++++++++++++++++++++++ patches/readline/readline70-003 | 40 ++++++++++++++ patches/readline/readline70-004 | 47 +++++++++++++++++ patches/readline/readline70-005 | 58 +++++++++++++++++++++ recipes/libs/readline/recipe | 6 +-- sources/SOURCELIST.txt | 2 +- sources/readline-7.0.tar.gz.sha256 | 1 + sources/readline-8.0.tar.gz.sha256 | 1 - 9 files changed, 310 insertions(+), 5 deletions(-) create mode 100644 patches/readline/readline70-001 create mode 100644 patches/readline/readline70-002 create mode 100644 patches/readline/readline70-003 create mode 100644 patches/readline/readline70-004 create mode 100644 patches/readline/readline70-005 create mode 100644 sources/readline-7.0.tar.gz.sha256 delete mode 100644 sources/readline-8.0.tar.gz.sha256 diff --git a/patches/readline/readline70-001 b/patches/readline/readline70-001 new file mode 100644 index 00000000..437a4401 --- /dev/null +++ b/patches/readline/readline70-001 @@ -0,0 +1,57 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-001 + +Bug-Reported-by: Sean Zha +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2016-09/msg00107.html + +Bug-Description: + +Readline-7.0 changed the way the history list is initially allocated to reduce +the number of reallocations and copies. Users who set the readline +history-size variable to a very large number to essentially unlimit the size +of the history list will get memory allocation errors + +Patch (apply with `patch -p0'): + +*** ../readline-7.0/history.c 2015-12-28 13:50:31.000000000 -0500 +--- history.c 2016-09-30 14:28:40.000000000 -0400 +*************** +*** 58,61 **** +--- 58,63 ---- + #define DEFAULT_HISTORY_INITIAL_SIZE 502 + ++ #define MAX_HISTORY_INITIAL_SIZE 8192 ++ + /* The number of slots to increase the_history by. */ + #define DEFAULT_HISTORY_GROW_SIZE 50 +*************** +*** 308,312 **** + { + if (history_stifled && history_max_entries > 0) +! history_size = history_max_entries + 2; + else + history_size = DEFAULT_HISTORY_INITIAL_SIZE; +--- 310,316 ---- + { + if (history_stifled && history_max_entries > 0) +! history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE) +! ? MAX_HISTORY_INITIAL_SIZE +! : history_max_entries + 2; + else + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 0 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 1 diff --git a/patches/readline/readline70-002 b/patches/readline/readline70-002 new file mode 100644 index 00000000..ac76daec --- /dev/null +++ b/patches/readline/readline70-002 @@ -0,0 +1,103 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-002 + +Bug-Reported-by: Hong Cho +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2016-12/msg00002.html + +Bug-Description: + +There is a race condition in add_history() that can be triggered by a fatal +signal arriving between the time the history length is updated and the time +the history list update is completed. A later attempt to reference an +invalid history entry can cause a crash. + +Patch (apply with `patch -p0'): + +*** ../readline-7.0-patched/history.c 2016-11-11 13:42:49.000000000 -0500 +--- history.c 2016-12-05 10:37:51.000000000 -0500 +*************** +*** 280,283 **** +--- 280,284 ---- + { + HIST_ENTRY *temp; ++ int new_length; + + if (history_stifled && (history_length == history_max_entries)) +*************** +*** 296,306 **** + /* Copy the rest of the entries, moving down one slot. Copy includes + trailing NULL. */ +- #if 0 +- for (i = 0; i < history_length; i++) +- the_history[i] = the_history[i + 1]; +- #else + memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *)); +- #endif + + history_base++; + } +--- 297,303 ---- + /* Copy the rest of the entries, moving down one slot. Copy includes + trailing NULL. */ + memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *)); + ++ new_length = history_length; + history_base++; + } +*************** +*** 316,320 **** + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *)); +! history_length = 1; + } + else +--- 313,317 ---- + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *)); +! new_length = 1; + } + else +*************** +*** 326,330 **** + xrealloc (the_history, history_size * sizeof (HIST_ENTRY *)); + } +! history_length++; + } + } +--- 323,327 ---- + xrealloc (the_history, history_size * sizeof (HIST_ENTRY *)); + } +! new_length = history_length + 1; + } + } +*************** +*** 332,337 **** + temp = alloc_history_entry ((char *)string, hist_inittime ()); + +! the_history[history_length] = (HIST_ENTRY *)NULL; +! the_history[history_length - 1] = temp; + } + +--- 329,335 ---- + temp = alloc_history_entry ((char *)string, hist_inittime ()); + +! the_history[new_length] = (HIST_ENTRY *)NULL; +! the_history[new_length - 1] = temp; +! history_length = new_length; + } + +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 1 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 2 diff --git a/patches/readline/readline70-003 b/patches/readline/readline70-003 new file mode 100644 index 00000000..a19cae6e --- /dev/null +++ b/patches/readline/readline70-003 @@ -0,0 +1,40 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-003 + +Bug-Reported-by: Frédéric Brière +Bug-Reference-ID: <20170120180724.7ydq7fb2hsp366dj@fabul.fbriere.net> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2017-01/msg00002.html + +Bug-Description: + +Readline-7.0 uses pselect(2) to allow readline to handle signals that do not +interrupt read(2), such as SIGALRM, before reading another character. The +signal mask used in the pselect call did not take into account signals the +calling application blocked before calling readline(). + +Patch (apply with `patch -p0'): + +*** ../readline-7.0-patched/input.c 2016-08-30 10:21:47.000000000 -0400 +--- input.c 2017-01-23 10:21:56.000000000 -0500 +*************** +*** 514,517 **** +--- 514,518 ---- + #if defined (HAVE_PSELECT) + sigemptyset (&empty_set); ++ sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &empty_set); + FD_ZERO (&readfds); + FD_SET (fileno (stream), &readfds); +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 2 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 3 diff --git a/patches/readline/readline70-004 b/patches/readline/readline70-004 new file mode 100644 index 00000000..e2f68060 --- /dev/null +++ b/patches/readline/readline70-004 @@ -0,0 +1,47 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-004 + +Bug-Reported-by: Kieran Grant +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2018-02/msg00002.html + +Bug-Description: + +With certain values for PS1, especially those that wrap onto three or more +lines, readline will miscalculate the number of invisible characters, +leading to crashes and core dumps. + +Patch (apply with `patch -p0'): + +*** ../readline-7.0.3/display.c 2016-07-28 14:49:33.000000000 -0400 +--- display.c 2018-02-03 19:19:35.000000000 -0500 +*************** +*** 772,776 **** + wadjust = (newlines == 0) + ? prompt_invis_chars_first_line +! : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line); + + /* fix from Darin Johnson for prompt string with +--- 788,794 ---- + wadjust = (newlines == 0) + ? prompt_invis_chars_first_line +! : ((newlines == prompt_lines_estimate) +! ? (wrap_offset - prompt_invis_chars_first_line) +! : 0); + + /* fix from Darin Johnson for prompt string with +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 3 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 4 + diff --git a/patches/readline/readline70-005 b/patches/readline/readline70-005 new file mode 100644 index 00000000..99753224 --- /dev/null +++ b/patches/readline/readline70-005 @@ -0,0 +1,58 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-005 + +Bug-Reported-by: Nuzhna Pomoshch +Bug-Reference-ID: <1317167476.1492079.1495999776464@mail.yahoo.com> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2017-05/msg00005.html + +Bug-Description: + +There are cases where a failing readline command (e.g., delete-char at the end +of a line) can cause a multi-character key sequence to `back up' and attempt +to re-read some of the characters in the sequence. + +Patch (apply with `patch -p0'): + +*** ../readline-7.0/readline.c 2016-04-20 15:53:52.000000000 -0400 +--- readline.c 2018-05-26 17:19:00.000000000 -0400 +*************** +*** 1058,1062 **** + r = _rl_dispatch (ANYOTHERKEY, m); + } +! else if (r && map[ANYOTHERKEY].function) + { + /* We didn't match (r is probably -1), so return something to +--- 1056,1060 ---- + r = _rl_dispatch (ANYOTHERKEY, m); + } +! else if (r < 0 && map[ANYOTHERKEY].function) + { + /* We didn't match (r is probably -1), so return something to +*************** +*** 1070,1074 **** + return -2; + } +! else if (r && got_subseq) + { + /* OK, back up the chain. */ +--- 1068,1072 ---- + return -2; + } +! else if (r < 0 && got_subseq) /* XXX */ + { + /* OK, back up the chain. */ +*** ../readline-7.0/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 4 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 5 + diff --git a/recipes/libs/readline/recipe b/recipes/libs/readline/recipe index 93663e04..4d5b7e83 100644 --- a/recipes/libs/readline/recipe +++ b/recipes/libs/readline/recipe @@ -15,8 +15,8 @@ # limitations under the License. program=readline -version=8.0 -release=1 +version=7.0 +release=3 # Set 'outdir' for a nice and well-organized output directory outdir="${outdir}/${arch}/libs" @@ -53,7 +53,7 @@ build() chmod -R u+w,go-w,a+rX-s . # Apply patches from upstream - for file in "${worktree}"/patches/readline/readline80-???* + for file in "${worktree}"/patches/readline/readline70-???* do if test -f "$file" then diff --git a/sources/SOURCELIST.txt b/sources/SOURCELIST.txt index e0af47b9..ef726261 100644 --- a/sources/SOURCELIST.txt +++ b/sources/SOURCELIST.txt @@ -16,7 +16,7 @@ ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz ftp://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.bz2 ftp://ftp.gnu.org/gnu/make/make-4.2.1.tar.bz2 ftp://ftp.gnu.org/gnu/patch/patch-2.7.6.tar.bz2 -ftp://ftp.gnu.org/gnu/readline/readline-8.0.tar.gz +ftp://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz ftp://ftp.ncftp.com/ncftp/ncftp-3.2.6-src.tar.gz ftp://ftp.porcupine.org/pub/security/tcp_wrappers_7.6-ipv6.4.tar.gz diff --git a/sources/readline-7.0.tar.gz.sha256 b/sources/readline-7.0.tar.gz.sha256 new file mode 100644 index 00000000..60994d39 --- /dev/null +++ b/sources/readline-7.0.tar.gz.sha256 @@ -0,0 +1 @@ +750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334 readline-7.0.tar.gz diff --git a/sources/readline-8.0.tar.gz.sha256 b/sources/readline-8.0.tar.gz.sha256 deleted file mode 100644 index 1d0a3d01..00000000 --- a/sources/readline-8.0.tar.gz.sha256 +++ /dev/null @@ -1 +0,0 @@ -e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461 readline-8.0.tar.gz -- 2.11.4.GIT