summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/readline/readline/readline82-006.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/readline/readline/readline82-006.patch')
-rw-r--r--meta/recipes-core/readline/readline/readline82-006.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/meta/recipes-core/readline/readline/readline82-006.patch b/meta/recipes-core/readline/readline/readline82-006.patch
new file mode 100644
index 0000000000..d66afe82c9
--- /dev/null
+++ b/meta/recipes-core/readline/readline/readline82-006.patch
@@ -0,0 +1,102 @@
1 READLINE PATCH REPORT
2 =====================
3
4Readline-Release: 8.2
5Patch-ID: readline82-006
6
7Bug-Reported-by: Tom de Vries <tdevries@suse.de>
8Bug-Reference-ID:
9Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2022-09/msg00001.html
10
11Bug-Description:
12
13This is a variant of the same issue as the one fixed by patch 5. In this
14case, the signal arrives and is pending before readline calls rl_getc().
15When this happens, the pending signal will be handled by the loop, but may
16alter or destroy some state that the callback uses. Readline needs to treat
17this case the same way it would if a signal interrupts pselect/select, so
18compound operations like searches and reading numeric arguments get cleaned
19up properly.
20
21Patch (apply with `patch -p0'):
22
23Upstream-Status: Submitted [https://ftp.gnu.org/gnu/readline/readline-8.2-patches/]
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25
26*** ../readline-8.2-patched/input.c 2022-12-22 16:15:48.000000000 -0500
27--- input.c 2023-01-10 11:53:45.000000000 -0500
28***************
29*** 812,816 ****
30 rl_getc (FILE *stream)
31 {
32! int result;
33 unsigned char c;
34 int fd;
35--- 812,816 ----
36 rl_getc (FILE *stream)
37 {
38! int result, ostate, osig;
39 unsigned char c;
40 int fd;
41***************
42*** 823,828 ****
43--- 823,842 ----
44 while (1)
45 {
46+ osig = _rl_caught_signal;
47+ ostate = rl_readline_state;
48+
49 RL_CHECK_SIGNALS ();
50
51+ #if defined (READLINE_CALLBACKS)
52+ /* Do signal handling post-processing here, but just in callback mode
53+ for right now because the signal cleanup can change some of the
54+ callback state, and we need to either let the application have a
55+ chance to react or abort some current operation that gets cleaned
56+ up by rl_callback_sigcleanup(). If not, we'll just run through the
57+ loop again. */
58+ if (osig != 0 && (ostate & RL_STATE_CALLBACK))
59+ goto postproc_signal;
60+ #endif
61+
62 /* We know at this point that _rl_caught_signal == 0 */
63
64***************
65*** 888,891 ****
66--- 902,908 ----
67
68 handle_error:
69+ osig = _rl_caught_signal;
70+ ostate = rl_readline_state;
71+
72 /* If the error that we received was EINTR, then try again,
73 this is simply an interrupted system call to read (). We allow
74***************
75*** 928,933 ****
76--- 945,959 ----
77 #endif /* SIGALRM */
78
79+ postproc_signal:
80+ /* POSIX says read(2)/pselect(2)/select(2) don't return EINTR for any
81+ reason other than being interrupted by a signal, so we can safely
82+ call the application's signal event hook. */
83 if (rl_signal_event_hook)
84 (*rl_signal_event_hook) ();
85+ #if defined (READLINE_CALLBACKS)
86+ else if (osig == SIGINT && (ostate & RL_STATE_CALLBACK) && (ostate & (RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_NUMERICARG)))
87+ /* just these cases for now */
88+ _rl_abort_internal ();
89+ #endif
90 }
91 }
92*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500
93--- patchlevel 2014-03-21 08:28:40.000000000 -0400
94***************
95*** 1,3 ****
96 # Do not edit -- exists only for use by patch
97
98! 5
99--- 1,3 ----
100 # Do not edit -- exists only for use by patch
101
102! 6