# HG changeset patch # User John Donoghue # Date 1608594372 18000 # Node ID 41e50d658de0da7ef46312a1e160c28cf7567fb9 # Parent 16d1cd92da016aacd7b5e581d96810ab272c6a2d readline: update to v8.1 * src/readline.mk: update version, checksum * src/readline-1-display.patch, src/readline-1-fixes.patch, src/readline-1-input.patch, src/readline-1-sigwinch.patch, src/readline-2-event-hook.patch: updated patch * src/readline-0-001.patch, src/readline-0-002.patch, src/readline-0-003.patch, src/readline-0-004.patch, src/readline-2-history.patch: removed files * dist-files.mk: removed ref to deleted files diff -r 16d1cd92da01 -r 41e50d658de0 dist-files.mk --- a/dist-files.mk Mon Dec 21 18:44:54 2020 -0500 +++ b/dist-files.mk Mon Dec 21 18:46:12 2020 -0500 @@ -630,16 +630,11 @@ qwtplot3d.mk \ rapidjson-1-prettywriter.patch \ rapidjson.mk \ - readline-0-001.patch \ - readline-0-002.patch \ - readline-0-003.patch \ - readline-0-004.patch \ readline-1-display.patch \ readline-1-fixes.patch \ readline-1-input.patch \ readline-1-sigwinch.patch \ readline-2-event-hook.patch \ - readline-2-history.patch \ readline.mk \ release-octave-1-gnulib.patch \ release-octave.mk \ diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-0-001.patch --- a/src/readline-0-001.patch Mon Dec 21 18:44:54 2020 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ - READLINE PATCH REPORT - ===================== - -Readline-Release: 8.0 -Patch-ID: readline80-001 - -Bug-Reported-by: chet.ramey@case.edu -Bug-Reference-ID: -Bug-Reference-URL: - -Bug-Description: - -The history file reading code doesn't close the file descriptor open to -the history file when it encounters a zero-length file. - -diff --git "a/histfile.c" "b/histfile.c" ---- a/histfile.c 2018-06-11 09:14:52.000000000 -0400 -+++ b/histfile.c 2019-05-16 15:55:57.000000000 -0400 -@@ -306,4 +306,5 @@ - { - free (input); -+ close (file); - return 0; /* don't waste time if we don't have to */ - } -diff --git "a/patchlevel" "b/patchlevel" ---- a/patchlevel 2013-11-15 08:11:11.000000000 -0500 -+++ b/patchlevel 2014-03-21 08:28:40.000000000 -0400 -@@ -1,3 +1,3 @@ - # Do not edit -- exists only for use by patch - --0 -+1 diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-0-002.patch --- a/src/readline-0-002.patch Mon Dec 21 18:44:54 2020 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ - READLINE PATCH REPORT - ===================== - -Readline-Release: 8.0 -Patch-ID: readline80-002 - -Bug-Reported-by: lessbug@qq.com -Bug-Reference-ID: -Bug-Reference-URL: - -Bug-Description: - -When using previous-history to go back beyond the beginning of the history list, -it's possible to move to an incorrect partial line. - -diff --git "a/misc.c" "b/misc.c" ---- a/misc.c 2017-07-07 17:30:12.000000000 -0400 -+++ b/misc.c 2019-05-16 11:43:46.000000000 -0400 -@@ -577,4 +577,5 @@ - { - HIST_ENTRY *old_temp, *temp; -+ int had_saved_line; - - if (count < 0) -@@ -589,4 +590,5 @@ - - /* If we don't have a line saved, then save this one. */ -+ had_saved_line = _rl_saved_line_for_history != 0; - rl_maybe_save_line (); - -@@ -612,5 +614,6 @@ - if (temp == 0) - { -- rl_maybe_unsave_line (); -+ if (had_saved_line == 0) -+ _rl_free_saved_history_line (); - rl_ding (); - } -diff --git "a/patchlevel" "b/patchlevel" ---- a/patchlevel 2013-11-15 08:11:11.000000000 -0500 -+++ b/patchlevel 2014-03-21 08:28:40.000000000 -0400 -@@ -1,3 +1,3 @@ - # Do not edit -- exists only for use by patch - --1 -+2 diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-0-003.patch --- a/src/readline-0-003.patch Mon Dec 21 18:44:54 2020 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ - READLINE PATCH REPORT - ===================== - -Readline-Release: 8.0 -Patch-ID: readline80-003 - -Bug-Reported-by: HIROSE Masaaki -Bug-Reference-ID: -Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-05/msg00038.html - -Bug-Description: - -Reading history entries with timestamps can result in history entries joined -by linefeeds. - -diff --git "a/histfile.c" "b/histfile.c" ---- a/histfile.c 2018-06-11 09:14:52.000000000 -0400 -+++ b/histfile.c 2019-05-16 15:55:57.000000000 -0400 -@@ -370,7 +370,9 @@ - - has_timestamps = HIST_TIMESTAMP_START (buffer); -- history_multiline_entries += has_timestamps && history_write_timestamps; -+ history_multiline_entries += has_timestamps && history_write_timestamps; - - /* Skip lines until we are at FROM. */ -+ if (has_timestamps) -+ last_ts = buffer; - for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++) - if (*line_end == '\n') -@@ -381,5 +383,16 @@ - if (HIST_TIMESTAMP_START(p) == 0) - current_line++; -+ else -+ last_ts = p; - line_start = p; -+ /* If we are at the last line (current_line == from) but we have -+ timestamps (has_timestamps), then line_start points to the -+ text of the last command, and we need to skip to its end. */ -+ if (current_line >= from && has_timestamps) -+ { -+ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++) -+ ; -+ line_start = (*line_end == '\n') ? line_end + 1 : line_end; -+ } - } - -diff --git "a/patchlevel" "b/patchlevel" ---- a/patchlevel 2013-11-15 08:11:11.000000000 -0500 -+++ b/patchlevel 2014-03-21 08:28:40.000000000 -0400 -@@ -1,3 +1,3 @@ - # Do not edit -- exists only for use by patch - --2 -+3 diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-0-004.patch --- a/src/readline-0-004.patch Mon Dec 21 18:44:54 2020 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - READLINE PATCH REPORT - ===================== - -Readline-Release: 8.0 -Patch-ID: readline80-004 - -Bug-Reported-by: auroralanes@protonmail.ch -Bug-Reference-ID: -Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2020-01/msg00008.html - -Bug-Description: - -If writing the history file fails, and renaming the backup history file fails, -it's possible for readline's history code to return the wrong error to its -caller. - -diff --git "a/histfile.c" "b/histfile.c" ---- a/histfile.c 2019-11-19 10:31:58.000000000 -0500 -+++ b/histfile.c 2020-02-01 16:28:29.000000000 -0500 -@@ -621,4 +621,5 @@ - if (rv != 0) - { -+ rv = errno; - if (tempname) - unlink (tempname); -@@ -768,4 +769,5 @@ - if (rv != 0) - { -+ rv = errno; - if (tempname) - unlink (tempname); -diff --git "a/patchlevel" "b/patchlevel" ---- a/patchlevel 2013-11-15 08:11:11.000000000 -0500 -+++ b/patchlevel 2014-03-21 08:28:40.000000000 -0400 -@@ -1,3 +1,3 @@ - # Do not edit -- exists only for use by patch - --3 -+4 diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-1-display.patch --- a/src/readline-1-display.patch Mon Dec 21 18:44:54 2020 -0500 +++ b/src/readline-1-display.patch Mon Dec 21 18:46:12 2020 -0500 @@ -1,6 +1,6 @@ -diff -ur readline-8.0.orig/display.c readline-8.0.disp/display.c ---- readline-8.0.orig/display.c 2019-03-20 07:41:37.573786782 -0400 -+++ readline-8.0.disp/display.c 2019-03-20 17:00:29.866659451 -0400 +diff -ur readline-8.1.orig/display.c readline-8.1/display.c +--- readline-8.1.orig/display.c 2020-12-19 07:41:44.122860975 -0500 ++++ readline-8.1/display.c 2020-12-19 07:52:09.009050414 -0500 @@ -59,6 +59,11 @@ #include "rlprivate.h" #include "xmalloc.h" @@ -13,7 +13,7 @@ #if !defined (strchr) && !defined (__STDC__) extern char *strchr (), *strrchr (); #endif /* !strchr && !__STDC__ */ -@@ -2367,6 +2372,20 @@ +@@ -2686,6 +2691,20 @@ int in_invisline; int mb_cur_max = MB_CUR_MAX; @@ -34,7 +34,7 @@ woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset); cpos = _rl_last_c_pos; -@@ -2519,6 +2538,20 @@ +@@ -2832,6 +2851,20 @@ { register int delta, i; @@ -55,7 +55,7 @@ if (_rl_last_v_pos == to || to > _rl_screenheight) return; -@@ -2848,6 +2881,17 @@ +@@ -3157,6 +3190,17 @@ void _rl_clear_to_eol (int count) { @@ -73,9 +73,9 @@ #ifndef __MSDOS__ if (_rl_term_clreol) tputs (_rl_term_clreol, 1, _rl_output_character_function); -@@ -2873,6 +2917,33 @@ +@@ -3182,6 +3226,33 @@ void - _rl_clear_screen (void) + _rl_clear_screen (int clrscr) { +#if defined (_WIN32) + COORD coordScreen = { 0, 0 }; diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-1-fixes.patch --- a/src/readline-1-fixes.patch Mon Dec 21 18:44:54 2020 -0500 +++ b/src/readline-1-fixes.patch Mon Dec 21 18:46:12 2020 -0500 @@ -1,16 +1,7 @@ -This file is part of MXE. See LICENSE.md for licensing information. - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Timothy Gu -Date: Tue, 30 Sep 2014 17:16:32 -0700 -Subject: [PATCH 1/1] Handle missing S_IS* macros more gracefully - - -diff --git a/colors.c b/colors.c -index 1111111..2222222 100644 ---- a/colors.c -+++ b/colors.c -@@ -200,8 +200,10 @@ _rl_print_color_indicator (const char *f) +diff -ur readline-8.1/colors.c readline-8.1.1/colors.c +--- readline-8.1/colors.c 2019-11-19 10:30:54.000000000 -0500 ++++ readline-8.1.1/colors.c 2020-12-19 07:54:28.888704198 -0500 +@@ -207,8 +207,10 @@ #endif if (is_colored (C_CAP) && 0) //f->has_capability) colored_filetype = C_CAP; @@ -21,7 +12,7 @@ else if ((1 < astat.st_nlink) && is_colored (C_MULTIHARDLINK)) colored_filetype = C_MULTIHARDLINK; } -@@ -215,8 +217,10 @@ _rl_print_color_indicator (const char *f) +@@ -222,8 +224,10 @@ colored_filetype = C_STICKY_OTHER_WRITABLE; else #endif @@ -32,11 +23,11 @@ #if defined (S_ISVTX) else if ((mode & S_ISVTX) != 0 && is_colored (C_STICKY)) colored_filetype = C_STICKY; -diff --git a/colors.h b/colors.h -index 1111111..2222222 100644 ---- a/colors.h -+++ b/colors.h -@@ -96,7 +96,7 @@ enum indicator_no +Only in readline-8.1.1: colors.c.orig +diff -ur readline-8.1/colors.h readline-8.1.1/colors.h +--- readline-8.1/colors.h 2016-01-25 10:38:11.000000000 -0500 ++++ readline-8.1.1/colors.h 2020-12-19 07:54:28.888704198 -0500 +@@ -96,7 +96,7 @@ }; @@ -45,10 +36,9 @@ # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) #endif -diff --git a/posixstat.h b/posixstat.h -index 1111111..2222222 100644 ---- a/posixstat.h -+++ b/posixstat.h +diff -ur readline-8.1/posixstat.h readline-8.1.1/posixstat.h +--- readline-8.1/posixstat.h 2019-12-19 11:24:37.000000000 -0500 ++++ readline-8.1.1/posixstat.h 2020-12-19 07:54:28.888704198 -0500 @@ -78,30 +78,44 @@ #if defined (S_IFBLK) && !defined (S_ISBLK) @@ -94,7 +84,7 @@ #endif /* -@@ -137,6 +151,8 @@ +@@ -157,6 +171,8 @@ /* These are non-standard, but are used in builtins.c$symbolic_umask() */ #define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH) #define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH) @@ -103,4 +93,3 @@ +#endif #endif /* _POSIXSTAT_H_ */ - diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-1-input.patch --- a/src/readline-1-input.patch Mon Dec 21 18:44:54 2020 -0500 +++ b/src/readline-1-input.patch Mon Dec 21 18:46:12 2020 -0500 @@ -1,7 +1,7 @@ -diff -ur readline-8.0.disp/input.c readline-8.0/input.c ---- readline-8.0.disp/input.c 2019-03-20 07:56:04.897036396 -0400 -+++ readline-8.0/input.c 2019-03-20 08:00:45.403401856 -0400 -@@ -519,7 +519,12 @@ +diff -ur readline-8.1.1/input.c readline-8.1.2/input.c +--- readline-8.1.1/input.c 2020-12-19 07:54:06.883500144 -0500 ++++ readline-8.1.2/input.c 2020-12-19 07:55:29.042995655 -0500 +@@ -538,7 +538,12 @@ #if defined (__MINGW32__) if (isatty (fileno (stream))) diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-1-sigwinch.patch --- a/src/readline-1-sigwinch.patch Mon Dec 21 18:44:54 2020 -0500 +++ b/src/readline-1-sigwinch.patch Mon Dec 21 18:46:12 2020 -0500 @@ -1,9 +1,7 @@ -Common subdirectories: readline-8.0.input/doc and readline-8.0/doc -Common subdirectories: readline-8.0.input/examples and readline-8.0/examples -diff -u readline-8.0.input/readline.c readline-8.0/readline.c ---- readline-8.0.input/readline.c 2019-03-20 08:02:03.533512025 -0400 -+++ readline-8.0/readline.c 2019-03-20 08:06:59.117185446 -0400 -@@ -1103,8 +1103,12 @@ +diff -ur readline-8.1.2/readline.c readline-8.1.3/readline.c +--- readline-8.1.2/readline.c 2020-12-19 07:55:06.477760951 -0500 ++++ readline-8.1.3/readline.c 2020-12-19 07:56:17.722659252 -0500 +@@ -1154,8 +1154,12 @@ RL_SETSTATE(RL_STATE_INITIALIZED); } else @@ -18,10 +16,10 @@ /* Initialize the current line information. */ _rl_init_line_state (); -Common subdirectories: readline-8.0.input/shlib and readline-8.0/shlib -diff -u readline-8.0.input/signals.c readline-8.0/signals.c ---- readline-8.0.input/signals.c 2019-03-20 08:02:03.529511918 -0400 -+++ readline-8.0/signals.c 2019-03-20 08:13:44.347195350 -0400 +Only in readline-8.1.3: readline.c.orig +diff -ur readline-8.1.2/signals.c readline-8.1.3/signals.c +--- readline-8.1.2/signals.c 2020-12-19 07:55:06.471760622 -0500 ++++ readline-8.1.3/signals.c 2020-12-19 08:19:50.548964783 -0500 @@ -46,6 +46,11 @@ #include "rlprivate.h" @@ -43,7 +41,18 @@ int rl_catch_sigwinch = 1; #else int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */ -@@ -495,6 +500,21 @@ +@@ -266,8 +271,10 @@ + case SIGQUIT: + #endif + ++#if defined (HAVE_POSIX_SIGNALS) + if (block_sig) + sigprocmask (SIG_BLOCK, &set, &oset); ++#endif + + rl_echo_signal_char (sig); + rl_cleanup_after_signal (); +@@ -532,6 +539,21 @@ } #endif /* SIGWINCH */ @@ -65,7 +74,7 @@ return 0; } -@@ -545,6 +565,20 @@ +@@ -582,6 +604,20 @@ sigwinch_set_flag = 0; } #endif @@ -86,4 +95,3 @@ return 0; } -Common subdirectories: readline-8.0.input/support and readline-8.0/support diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-2-event-hook.patch --- a/src/readline-2-event-hook.patch Mon Dec 21 18:44:54 2020 -0500 +++ b/src/readline-2-event-hook.patch Mon Dec 21 18:46:12 2020 -0500 @@ -1,7 +1,7 @@ -diff -ur readline-8.0.sigwinch/input.c readline-8.0/input.c ---- readline-8.0.sigwinch/input.c 2019-03-20 08:15:55.450361377 -0400 -+++ readline-8.0/input.c 2019-03-20 08:30:58.059756179 -0400 -@@ -140,6 +140,11 @@ +diff -ur readline-8.1.3/input.c readline-8.1.4/input.c +--- readline-8.1.3/input.c 2020-12-19 07:56:01.572775578 -0500 ++++ readline-8.1.4/input.c 2020-12-19 07:57:24.608319024 -0500 +@@ -142,6 +142,11 @@ static unsigned char ibuffer[512]; static int ibuffer_len = sizeof (ibuffer) - 1; @@ -13,7 +13,7 @@ #define any_typein (push_index != pop_index) int -@@ -266,7 +271,7 @@ +@@ -268,7 +273,7 @@ #if defined (__MINGW32__) /* Use getch/_kbhit to check for available console input, in the same way that we read it normally. */ @@ -22,7 +22,7 @@ result = 0; #endif -@@ -501,6 +506,120 @@ +@@ -520,6 +525,120 @@ return (c); } @@ -143,7 +143,7 @@ int rl_getc (FILE *stream) { -@@ -520,9 +639,9 @@ +@@ -539,9 +658,9 @@ #if defined (__MINGW32__) if (isatty (fileno (stream))) { diff -r 16d1cd92da01 -r 41e50d658de0 src/readline-2-history.patch --- a/src/readline-2-history.patch Mon Dec 21 18:44:54 2020 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -diff -ur readline-8.0.eventhook/histfile.c readline-8.0/histfile.c ---- readline-8.0.eventhook/histfile.c 2019-04-03 10:21:42.916563353 -0400 -+++ readline-8.0/histfile.c 2019-04-03 16:16:04.605404093 -0400 -@@ -107,6 +107,11 @@ - # define PATH_MAX 1024 /* default */ - #endif - -+#if defined(_WIN32) -+ #define WIN32_LEAN_AND_MEAN -+ #include -+#endif -+ - extern void _hs_append_history_line PARAMS((int, const char *)); - - /* history file version; currently unused */ -@@ -139,6 +144,19 @@ - static int histfile_backup PARAMS((const char *, const char *)); - static int histfile_restore PARAMS((const char *, const char *)); - -+static int -+history_rename(const char *from, const char *to) -+{ -+#if defined(_WIN32) -+ if (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING)) { -+ return -1; -+ } -+ return 0; -+#else -+ return rename(from, to); -+#endif -+} -+ - /* Return the string that should be used in the place of this - filename. This only matters when you don't specify the - filename to read_history (), or write_history (). */ -@@ -448,10 +466,10 @@ - if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0) - { - linkbuf[n] = '\0'; -- return (rename (linkbuf, back)); -+ return (history_rename (linkbuf, back)); - } - #endif -- return (rename (filename, back)); -+ return (history_rename (filename, back)); - } - - /* Restore ORIG from BACKUP handling case where ORIG is a symlink -@@ -467,10 +485,10 @@ - if ((n = readlink (orig, linkbuf, sizeof (linkbuf) - 1)) > 0) - { - linkbuf[n] = '\0'; -- return (rename (backup, linkbuf)); -+ return (history_rename (backup, linkbuf)); - } - #endif -- return (rename (backup, orig)); -+ return (history_rename (backup, orig)); - } - - /* Truncate the history file FNAME, leaving only LINES trailing lines. diff -r 16d1cd92da01 -r 41e50d658de0 src/readline.mk --- a/src/readline.mk Mon Dec 21 18:44:54 2020 -0500 +++ b/src/readline.mk Mon Dec 21 18:46:12 2020 -0500 @@ -3,8 +3,8 @@ PKG := readline $(PKG)_IGNORE := -$(PKG)_VERSION := 8.0 -$(PKG)_CHECKSUM := d58041c2143595dc001d2777ae9a200be30198b0 +$(PKG)_VERSION := 8.1 +$(PKG)_CHECKSUM := 48c5e0c3a212449e206e21ba82856accac842c6f $(PKG)_SUBDIR := readline-$($(PKG)_VERSION) $(PKG)_FILE := readline-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://ftp.gnu.org/gnu/readline/$($(PKG)_FILE)