Moved these packages into Fedora.
[fedora-mingw.git] / readline / readline-5.2-redisplay-sigint.patch
1 GDB PR 544: gdb.cp/annota2.exp and gdb.cp/annota3.exp sometimes FAIL with:
2         FAIL: gdb.cp/annota3.exp: annotate-quit (pattern 1)
3
4 One can put `sleep (1)' at the end of _RL_OUTPUT_SOME_CHARS and type
5         p 1<enter><ctrl-c>
6 to abort the prompt printing. Before the patch:
7         (gdb) p 1
8         $1 = 1
9         Quit) (gdb) 
10         (gdb) _
11 After the patch:
12         [bash]jkratoch@host0.dyn.jankratochvil.net:/home/jkratoch/redhat/sources/readline# ../gdb/gdb -nx -silent(gdb) p 1
13         $1 = 1
14         (gdb) Quit
15         (gdb) _
16
17 The readline patch posted upstream:
18         http://sourceware.org/ml/gdb-patches/2008-03/msg00317.html
19
20 On Fri, 21 Mar 2008 19:37:31 +0100, Chet Ramey wrote:
21 > I will add something like your block_sigint/release_sigint changes around
22 > the guts of rl_redisplay.  That's the right thing to do anyway.  It will
23 > probably not come out as a patch for readline-5.2; you can use your
24 > current patch (though the names will change to _rl_block_sigint and
25 > _rl_release_sigint -- fair warning).
26
27 Application cannot easily supply its own RL_REDISPLAY_FUNCTION as a custom
28 function there changes the readline behavior:
29         http://sourceware.org/ml/gdb-patches/2008-03/msg00340.html
30
31 BLOCK_SIGINT / RELEASE_SIGINT: Make it public and prefix it by `_rl_'.
32 RL_REDISPLAY: Wrap it by _RL_BLOCK_SIGINT / _RL_RELEASE_SIGINT.
33
34 --- readline-5.2-orig/display.c 2008-03-23 20:52:12.000000000 +0100
35 +++ readline-5.2/display.c      2008-03-23 20:56:58.000000000 +0100
36 @@ -472,6 +472,10 @@ rl_redisplay ()
37    if (!readline_echoing_p)
38      return;
39  
40 +  /* Signals are blocked through this function as the global data structures
41 +     could get corrupted upon modifications from an invoked signal handler. */
42 +  _rl_block_sigint ();
43 +
44    if (!rl_display_prompt)
45      rl_display_prompt = "";
46  
47 @@ -1180,6 +1184,8 @@ rl_redisplay ()
48      else
49        visible_wrap_offset = wrap_offset;
50    }
51 +
52 +  _rl_release_sigint ();
53  }
54  
55  /* PWP: update_line() is based on finding the middle difference of each
56 --- readline-5.2-orig/rltty.c   2005-12-26 23:21:50.000000000 +0100
57 +++ readline-5.2/rltty.c        2008-03-23 20:57:26.000000000 +0100
58 @@ -52,8 +52,8 @@ extern int errno;
59  rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
60  rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
61  
62 -static void block_sigint PARAMS((void));
63 -static void release_sigint PARAMS((void));
64 +void _rl_block_sigint PARAMS((void));
65 +void _rl_release_sigint PARAMS((void));
66  
67  static void set_winsize PARAMS((int));
68  
69 @@ -74,9 +74,9 @@ static int sigint_oldmask;
70  static int sigint_blocked;
71  
72  /* Cause SIGINT to not be delivered until the corresponding call to
73 -   release_sigint(). */
74 -static void
75 -block_sigint ()
76 +   _rl_release_sigint(). */
77 +void
78 +_rl_block_sigint ()
79  {
80    if (sigint_blocked)
81      return;
82 @@ -100,8 +100,8 @@ block_sigint ()
83  }
84  
85  /* Allow SIGINT to be delivered. */
86 -static void
87 -release_sigint ()
88 +void
89 +_rl_release_sigint ()
90  {
91    if (sigint_blocked == 0)
92      return;
93 @@ -663,7 +663,7 @@ rl_prep_terminal (meta_flag)
94      return;
95  
96    /* Try to keep this function from being INTerrupted. */
97 -  block_sigint ();
98 +  _rl_block_sigint ();
99  
100    tty = fileno (rl_instream);
101  
102 @@ -676,7 +676,7 @@ rl_prep_terminal (meta_flag)
103        if (errno == ENOTTY)
104  #endif
105         readline_echoing_p = 1;         /* XXX */
106 -      release_sigint ();
107 +      _rl_release_sigint ();
108        return;
109      }
110  
111 @@ -711,7 +711,7 @@ rl_prep_terminal (meta_flag)
112  
113    if (set_tty_settings (tty, &tio) < 0)
114      {
115 -      release_sigint ();
116 +      _rl_release_sigint ();
117        return;
118      }
119  
120 @@ -722,7 +722,7 @@ rl_prep_terminal (meta_flag)
121    terminal_prepped = 1;
122    RL_SETSTATE(RL_STATE_TERMPREPPED);
123  
124 -  release_sigint ();
125 +  _rl_release_sigint ();
126  }
127  
128  /* Restore the terminal's normal settings and modes. */
129 @@ -735,7 +735,7 @@ rl_deprep_terminal ()
130      return;
131  
132    /* Try to keep this function from being interrupted. */
133 -  block_sigint ();
134 +  _rl_block_sigint ();
135  
136    tty = fileno (rl_instream);
137  
138 @@ -746,14 +746,14 @@ rl_deprep_terminal ()
139  
140    if (set_tty_settings (tty, &otio) < 0)
141      {
142 -      release_sigint ();
143 +      _rl_release_sigint ();
144        return;
145      }
146  
147    terminal_prepped = 0;
148    RL_UNSETSTATE(RL_STATE_TERMPREPPED);
149  
150 -  release_sigint ();
151 +  _rl_release_sigint ();
152  }
153  #endif /* !NO_TTY_DRIVER */
154  \f
155 --- readline-5.2-orig/rltty.h   2003-02-01 04:43:11.000000000 +0100
156 +++ readline-5.2/rltty.h        2008-03-23 20:57:30.000000000 +0100
157 @@ -79,4 +79,7 @@ typedef struct _rl_tty_chars {
158    unsigned char t_status;
159  } _RL_TTY_CHARS;
160  
161 +extern void _rl_block_sigint PARAMS((void));
162 +extern void _rl_release_sigint PARAMS((void));
163 +
164  #endif /* _RLTTY_H_ */