]>
Commit | Line | Data |
---|---|---|
478508cd ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.130 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.2.130 | |
11 | Problem: Vim may haing until CTRL-C is typed when using CTRL-Z. | |
12 | Solution: Avoid using pause(). Also use "volatile" for variables used in | |
13 | signal functions. (Dominique Pelle) | |
14 | Files: src/auto/configure, src/configure.in, src/config.h.in, | |
15 | src/globals.h, src/os_unix.c | |
16 | ||
17 | ||
18 | *** ../vim-7.2.129/src/auto/configure Thu Nov 20 10:36:04 2008 | |
19 | --- src/auto/configure Mon Mar 2 02:36:52 2009 | |
20 | *************** | |
21 | *** 11565,11570 **** | |
22 | --- 11565,11631 ---- | |
23 | ||
24 | fi | |
25 | ||
26 | + { $as_echo "$as_me:$LINENO: checking for working volatile" >&5 | |
27 | + $as_echo_n "checking for working volatile... " >&6; } | |
28 | + if test "${ac_cv_c_volatile+set}" = set; then | |
29 | + $as_echo_n "(cached) " >&6 | |
30 | + else | |
31 | + cat >conftest.$ac_ext <<_ACEOF | |
32 | + /* confdefs.h. */ | |
33 | + _ACEOF | |
34 | + cat confdefs.h >>conftest.$ac_ext | |
35 | + cat >>conftest.$ac_ext <<_ACEOF | |
36 | + /* end confdefs.h. */ | |
37 | + | |
38 | + int | |
39 | + main () | |
40 | + { | |
41 | + | |
42 | + volatile int x; | |
43 | + int * volatile y = (int *) 0; | |
44 | + return !x && !y; | |
45 | + ; | |
46 | + return 0; | |
47 | + } | |
48 | + _ACEOF | |
49 | + rm -f conftest.$ac_objext | |
50 | + if { (ac_try="$ac_compile" | |
51 | + case "(($ac_try" in | |
52 | + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
53 | + *) ac_try_echo=$ac_try;; | |
54 | + esac | |
55 | + eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | |
56 | + $as_echo "$ac_try_echo") >&5 | |
57 | + (eval "$ac_compile") 2>conftest.er1 | |
58 | + ac_status=$? | |
59 | + grep -v '^ *+' conftest.er1 >conftest.err | |
60 | + rm -f conftest.er1 | |
61 | + cat conftest.err >&5 | |
62 | + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | |
63 | + (exit $ac_status); } && { | |
64 | + test -z "$ac_c_werror_flag" || | |
65 | + test ! -s conftest.err | |
66 | + } && test -s conftest.$ac_objext; then | |
67 | + ac_cv_c_volatile=yes | |
68 | + else | |
69 | + $as_echo "$as_me: failed program was:" >&5 | |
70 | + sed 's/^/| /' conftest.$ac_ext >&5 | |
71 | + | |
72 | + ac_cv_c_volatile=no | |
73 | + fi | |
74 | + | |
75 | + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
76 | + fi | |
77 | + { $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 | |
78 | + $as_echo "$ac_cv_c_volatile" >&6; } | |
79 | + if test $ac_cv_c_volatile = no; then | |
80 | + | |
81 | + cat >>confdefs.h <<\_ACEOF | |
82 | + #define volatile /**/ | |
83 | + _ACEOF | |
84 | + | |
85 | + fi | |
86 | + | |
87 | { $as_echo "$as_me:$LINENO: checking for mode_t" >&5 | |
88 | $as_echo_n "checking for mode_t... " >&6; } | |
89 | if test "${ac_cv_type_mode_t+set}" = set; then | |
90 | *** ../vim-7.2.129/src/configure.in Thu Nov 20 10:36:04 2008 | |
91 | --- src/configure.in Sun Feb 22 21:47:44 2009 | |
92 | *************** | |
93 | *** 2148,2153 **** | |
94 | --- 2148,2154 ---- | |
95 | dnl Checks for typedefs, structures, and compiler characteristics. | |
96 | AC_PROG_GCC_TRADITIONAL | |
97 | AC_C_CONST | |
98 | + AC_C_VOLATILE | |
99 | AC_TYPE_MODE_T | |
100 | AC_TYPE_OFF_T | |
101 | AC_TYPE_PID_T | |
102 | *** ../vim-7.2.129/src/config.h.in Tue Jun 24 23:47:46 2008 | |
103 | --- src/config.h.in Mon Feb 23 00:13:17 2009 | |
104 | *************** | |
105 | *** 50,55 **** | |
106 | --- 50,58 ---- | |
107 | /* Define to empty if the keyword does not work. */ | |
108 | #undef const | |
109 | ||
110 | + /* Define to empty if the keyword does not work. */ | |
111 | + #undef volatile | |
112 | + | |
113 | /* Define to `int' if <sys/types.h> doesn't define. */ | |
114 | #undef mode_t | |
115 | ||
116 | *** ../vim-7.2.129/src/globals.h Tue Jan 6 16:13:42 2009 | |
117 | --- src/globals.h Mon Mar 2 02:40:16 2009 | |
118 | *************** | |
119 | *** 482,489 **** | |
120 | /* | |
121 | * While executing external commands or in Ex mode, should not insert GUI | |
122 | * events in the input buffer: Set hold_gui_events to non-zero. | |
123 | */ | |
124 | ! EXTERN int hold_gui_events INIT(= 0); | |
125 | ||
126 | /* | |
127 | * When resizing the shell is postponed, remember the new size, and call | |
128 | --- 482,491 ---- | |
129 | /* | |
130 | * While executing external commands or in Ex mode, should not insert GUI | |
131 | * events in the input buffer: Set hold_gui_events to non-zero. | |
132 | + * | |
133 | + * volatile because it is used in signal handler sig_sysmouse(). | |
134 | */ | |
135 | ! EXTERN volatile int hold_gui_events INIT(= 0); | |
136 | ||
137 | /* | |
138 | * When resizing the shell is postponed, remember the new size, and call | |
139 | *************** | |
140 | *** 597,603 **** | |
141 | EXTERN int really_exiting INIT(= FALSE); | |
142 | /* TRUE when we are sure to exit, e.g., after | |
143 | * a deadly signal */ | |
144 | ! EXTERN int full_screen INIT(= FALSE); | |
145 | /* TRUE when doing full-screen output | |
146 | * otherwise only writing some messages */ | |
147 | ||
148 | --- 599,606 ---- | |
149 | EXTERN int really_exiting INIT(= FALSE); | |
150 | /* TRUE when we are sure to exit, e.g., after | |
151 | * a deadly signal */ | |
152 | ! /* volatile because it is used in signal handler deathtrap(). */ | |
153 | ! EXTERN volatile int full_screen INIT(= FALSE); | |
154 | /* TRUE when doing full-screen output | |
155 | * otherwise only writing some messages */ | |
156 | ||
157 | *************** | |
158 | *** 739,748 **** | |
159 | */ | |
160 | EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */ | |
161 | # ifdef SIGHASARG | |
162 | ! EXTERN int lc_signal; /* catched signal number, 0 when no was signal | |
163 | ! catched; used for mch_libcall() */ | |
164 | # endif | |
165 | ! EXTERN int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */ | |
166 | #endif | |
167 | ||
168 | #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT) | |
169 | --- 747,758 ---- | |
170 | */ | |
171 | EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */ | |
172 | # ifdef SIGHASARG | |
173 | ! /* volatile because it is used in signal handlers. */ | |
174 | ! EXTERN volatile int lc_signal; /* caught signal number, 0 when no was signal | |
175 | ! caught; used for mch_libcall() */ | |
176 | # endif | |
177 | ! /* volatile because it is used in signal handler deathtrap(). */ | |
178 | ! EXTERN volatile int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */ | |
179 | #endif | |
180 | ||
181 | #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT) | |
182 | *************** | |
183 | *** 986,992 **** | |
184 | EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */ | |
185 | EXTERN int read_cmd_fd INIT(= 0); /* fd to read commands from */ | |
186 | ||
187 | ! EXTERN int got_int INIT(= FALSE); /* set to TRUE when interrupt | |
188 | signal occurred */ | |
189 | #ifdef USE_TERM_CONSOLE | |
190 | EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */ | |
191 | --- 996,1003 ---- | |
192 | EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */ | |
193 | EXTERN int read_cmd_fd INIT(= 0); /* fd to read commands from */ | |
194 | ||
195 | ! /* volatile because it is used in signal handler catch_sigint(). */ | |
196 | ! EXTERN volatile int got_int INIT(= FALSE); /* set to TRUE when interrupt | |
197 | signal occurred */ | |
198 | #ifdef USE_TERM_CONSOLE | |
199 | EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */ | |
200 | *** ../vim-7.2.129/src/os_unix.c Sun Feb 22 02:51:37 2009 | |
201 | --- src/os_unix.c Mon Mar 2 01:05:50 2009 | |
202 | *************** | |
203 | *** 181,187 **** | |
204 | && defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK) | |
205 | # define SET_SIG_ALARM | |
206 | static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG); | |
207 | ! static int sig_alarm_called; | |
208 | #endif | |
209 | static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG); | |
210 | ||
211 | --- 181,188 ---- | |
212 | && defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK) | |
213 | # define SET_SIG_ALARM | |
214 | static RETSIGTYPE sig_alarm __ARGS(SIGPROTOARG); | |
215 | ! /* volatile because it is used in signal handler sig_alarm(). */ | |
216 | ! static volatile int sig_alarm_called; | |
217 | #endif | |
218 | static RETSIGTYPE deathtrap __ARGS(SIGPROTOARG); | |
219 | ||
220 | *************** | |
221 | *** 201,213 **** | |
222 | # define SIG_ERR ((RETSIGTYPE (*)())-1) | |
223 | #endif | |
224 | ||
225 | ! static int do_resize = FALSE; | |
226 | #ifndef __EMX__ | |
227 | static char_u *extra_shell_arg = NULL; | |
228 | static int show_shell_mess = TRUE; | |
229 | #endif | |
230 | ! static int deadly_signal = 0; /* The signal we caught */ | |
231 | ! static int in_mch_delay = FALSE; /* sleeping in mch_delay() */ | |
232 | ||
233 | static int curr_tmode = TMODE_COOK; /* contains current terminal mode */ | |
234 | ||
235 | --- 202,217 ---- | |
236 | # define SIG_ERR ((RETSIGTYPE (*)())-1) | |
237 | #endif | |
238 | ||
239 | ! /* volatile because it is used in signal handler sig_winch(). */ | |
240 | ! static volatile int do_resize = FALSE; | |
241 | #ifndef __EMX__ | |
242 | static char_u *extra_shell_arg = NULL; | |
243 | static int show_shell_mess = TRUE; | |
244 | #endif | |
245 | ! /* volatile because it is used in signal handler deathtrap(). */ | |
246 | ! static volatile int deadly_signal = 0; /* The signal we caught */ | |
247 | ! /* volatile because it is used in signal handler deathtrap(). */ | |
248 | ! static volatile int in_mch_delay = FALSE; /* sleeping in mch_delay() */ | |
249 | ||
250 | static int curr_tmode = TMODE_COOK; /* contains current terminal mode */ | |
251 | ||
252 | *************** | |
253 | *** 802,808 **** | |
254 | #endif | |
255 | ||
256 | /* | |
257 | ! * We need correct potatotypes for a signal function, otherwise mean compilers | |
258 | * will barf when the second argument to signal() is ``wrong''. | |
259 | * Let me try it with a few tricky defines from my own osdef.h (jw). | |
260 | */ | |
261 | --- 806,812 ---- | |
262 | #endif | |
263 | ||
264 | /* | |
265 | ! * We need correct prototypes for a signal function, otherwise mean compilers | |
266 | * will barf when the second argument to signal() is ``wrong''. | |
267 | * Let me try it with a few tricky defines from my own osdef.h (jw). | |
268 | */ | |
269 | *************** | |
270 | *** 1068,1080 **** | |
271 | SIGRETURN; | |
272 | } | |
273 | ||
274 | ! #ifdef _REENTRANT | |
275 | /* | |
276 | * On Solaris with multi-threading, suspending might not work immediately. | |
277 | * Catch the SIGCONT signal, which will be used as an indication whether the | |
278 | * suspending has been done or not. | |
279 | */ | |
280 | ! static int sigcont_received; | |
281 | static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG); | |
282 | ||
283 | /* | |
284 | --- 1072,1089 ---- | |
285 | SIGRETURN; | |
286 | } | |
287 | ||
288 | ! #if defined(_REENTRANT) && defined(SIGCONT) | |
289 | /* | |
290 | * On Solaris with multi-threading, suspending might not work immediately. | |
291 | * Catch the SIGCONT signal, which will be used as an indication whether the | |
292 | * suspending has been done or not. | |
293 | + * | |
294 | + * On Linux, signal is not always handled immediately either. | |
295 | + * See https://bugs.launchpad.net/bugs/291373 | |
296 | + * | |
297 | + * volatile because it is used in in signal handler sigcont_handler(). | |
298 | */ | |
299 | ! static volatile int sigcont_received; | |
300 | static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG); | |
301 | ||
302 | /* | |
303 | *************** | |
304 | *** 1118,1132 **** | |
305 | } | |
306 | # endif | |
307 | ||
308 | ! # ifdef _REENTRANT | |
309 | sigcont_received = FALSE; | |
310 | # endif | |
311 | kill(0, SIGTSTP); /* send ourselves a STOP signal */ | |
312 | ! # ifdef _REENTRANT | |
313 | ! /* When we didn't suspend immediately in the kill(), do it now. Happens | |
314 | ! * on multi-threaded Solaris. */ | |
315 | ! if (!sigcont_received) | |
316 | ! pause(); | |
317 | # endif | |
318 | ||
319 | # ifdef FEAT_TITLE | |
320 | --- 1127,1154 ---- | |
321 | } | |
322 | # endif | |
323 | ||
324 | ! # if defined(_REENTRANT) && defined(SIGCONT) | |
325 | sigcont_received = FALSE; | |
326 | # endif | |
327 | kill(0, SIGTSTP); /* send ourselves a STOP signal */ | |
328 | ! # if defined(_REENTRANT) && defined(SIGCONT) | |
329 | ! /* | |
330 | ! * Wait for the SIGCONT signal to be handled. It generally happens | |
331 | ! * immediately, but somehow not all the time. Do not call pause() | |
332 | ! * because there would be race condition which would hang Vim if | |
333 | ! * signal happened in between the test of sigcont_received and the | |
334 | ! * call to pause(). If signal is not yet received, call sleep(0) | |
335 | ! * to just yield CPU. Signal should then be received. If somehow | |
336 | ! * it's still not received, sleep 1, 2, 3 ms. Don't bother waiting | |
337 | ! * further if signal is not received after 1+2+3+4 ms (not expected | |
338 | ! * to happen). | |
339 | ! */ | |
340 | ! { | |
341 | ! long wait; | |
342 | ! for (wait = 0; !sigcont_received && wait <= 3L; wait++) | |
343 | ! /* Loop is not entered most of the time */ | |
344 | ! mch_delay(wait, FALSE); | |
345 | ! } | |
346 | # endif | |
347 | ||
348 | # ifdef FEAT_TITLE | |
349 | *************** | |
350 | *** 1175,1181 **** | |
351 | #ifdef SIGTSTP | |
352 | signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); | |
353 | #endif | |
354 | ! #ifdef _REENTRANT | |
355 | signal(SIGCONT, sigcont_handler); | |
356 | #endif | |
357 | ||
358 | --- 1197,1203 ---- | |
359 | #ifdef SIGTSTP | |
360 | signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); | |
361 | #endif | |
362 | ! #if defined(_REENTRANT) && defined(SIGCONT) | |
363 | signal(SIGCONT, sigcont_handler); | |
364 | #endif | |
365 | ||
366 | *************** | |
367 | *** 1234,1240 **** | |
368 | reset_signals() | |
369 | { | |
370 | catch_signals(SIG_DFL, SIG_DFL); | |
371 | ! #ifdef _REENTRANT | |
372 | /* SIGCONT isn't in the list, because its default action is ignore */ | |
373 | signal(SIGCONT, SIG_DFL); | |
374 | #endif | |
375 | --- 1256,1262 ---- | |
376 | reset_signals() | |
377 | { | |
378 | catch_signals(SIG_DFL, SIG_DFL); | |
379 | ! #if defined(_REENTRANT) && defined(SIGCONT) | |
380 | /* SIGCONT isn't in the list, because its default action is ignore */ | |
381 | signal(SIGCONT, SIG_DFL); | |
382 | #endif | |
383 | *************** | |
384 | *** 5899,5905 **** | |
385 | --- 5921,5929 ---- | |
386 | * we are going to suspend or starting an external process | |
387 | * so we shouldn't have problem with this | |
388 | */ | |
389 | + # ifdef SIGTSTP | |
390 | signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); | |
391 | + # endif | |
392 | return 1; /* succeed */ | |
393 | } | |
394 | if (gpm_fd == -2) | |
395 | *** ../vim-7.2.129/src/version.c Mon Mar 2 02:11:09 2009 | |
396 | --- src/version.c Mon Mar 2 02:36:00 2009 | |
397 | *************** | |
398 | *** 678,679 **** | |
399 | --- 678,681 ---- | |
400 | { /* Add new patch number below this line */ | |
401 | + /**/ | |
402 | + 130, | |
403 | /**/ | |
404 | ||
405 | -- | |
406 | hundred-and-one symptoms of being an internet addict: | |
407 | 148. You find it easier to dial-up the National Weather Service | |
408 | Weather/your_town/now.html than to simply look out the window. | |
409 | ||
410 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
411 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
412 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
413 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |