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