Now on revision 110355. ------------------------------------------------------------ revno: 110355 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-03 22:52:49 -0700 message: * profiler.c (handle_profiler_signal): Inhibit pending signals too, to avoid similar races. * keyboard.c (pending_signals): Now bool, not int. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-02 19:38:10 +0000 +++ src/ChangeLog 2012-10-04 05:52:49 +0000 @@ -1,3 +1,9 @@ +2012-10-04 Paul Eggert + + * profiler.c (handle_profiler_signal): Inhibit pending signals too, + to avoid similar races. + * keyboard.c (pending_signals): Now bool, not int. + 2012-10-02 Paul Eggert * profiler.c (handle_profiler_signal): Fix a malloc race === modified file 'src/keyboard.c' --- src/keyboard.c 2012-10-01 06:36:54 +0000 +++ src/keyboard.c 2012-10-04 05:52:49 +0000 @@ -76,9 +76,9 @@ /* Positive if interrupt input is blocked right now. */ volatile int interrupt_input_blocked; -/* Nonzero means an input interrupt or alarm signal has arrived. +/* True means an input interrupt or alarm signal has arrived. The QUIT macro checks this. */ -volatile int pending_signals; +volatile bool pending_signals; #define KBD_BUFFER_SIZE 4096 === modified file 'src/lisp.h' --- src/lisp.h 2012-10-01 02:07:14 +0000 +++ src/lisp.h 2012-10-04 05:52:49 +0000 @@ -2131,7 +2131,7 @@ a request to exit Emacs when it is safe to do. */ extern void process_pending_signals (void); -extern int volatile pending_signals; +extern bool volatile pending_signals; extern void process_quit_flag (void); #define QUIT \ === modified file 'src/profiler.c' --- src/profiler.c 2012-10-04 00:10:47 +0000 +++ src/profiler.c 2012-10-04 05:52:49 +0000 @@ -239,6 +239,7 @@ else { Lisp_Object oquit; + bool saved_pending_signals; EMACS_INT count = 1; #ifdef HAVE_ITIMERSPEC if (profiler_timer_ok) @@ -252,12 +253,15 @@ uses QUIT, which can call malloc, which can cause disaster in a signal handler. So inhibit QUIT. */ oquit = Vinhibit_quit; + saved_pending_signals = pending_signals; Vinhibit_quit = Qt; + pending_signals = 0; eassert (HASH_TABLE_P (cpu_log)); record_backtrace (XHASH_TABLE (cpu_log), count); Vinhibit_quit = oquit; + pending_signals = saved_pending_signals; } } ------------------------------------------------------------ revno: 110354 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-03 17:10:47 -0700 message: Port timers to OpenBSD, plus check for timer failures. OpenBSD problem reported by Han Boetes. * profiler.c (setup_cpu_timer): Check for failure of timer_settime and/or setitimer. (Fprofiler_cpu_stop): Don't assume HAVE_SETITIMER. * syssignal.h (HAVE_ITIMERSPEC): New macro. This is for platforms like OpenBSD, which has timer_settime but does not declare it. OpenBSD does not define SIGEV_SIGNAL, so use that when deciding whether to use itimerspec-related primitives. All uses of HAVE_TIMER_SETTIME replaced with HAVE_ITIMERSPEC. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-30 04:19:32 +0000 +++ ChangeLog 2012-10-04 00:10:47 +0000 @@ -1,3 +1,16 @@ +2012-10-04 Paul Eggert + + Port timers to OpenBSD, plus check for timer failures. + OpenBSD problem reported by Han Boetes. + * profiler.c (setup_cpu_timer): Check for failure of timer_settime + and/or setitimer. + (Fprofiler_cpu_stop): Don't assume HAVE_SETITIMER. + * syssignal.h (HAVE_ITIMERSPEC): New macro. This is for platforms + like OpenBSD, which has timer_settime but does not declare it. + OpenBSD does not define SIGEV_SIGNAL, so use that when deciding + whether to use itimerspec-related primitives. All uses of + HAVE_TIMER_SETTIME replaced with HAVE_ITIMERSPEC. + 2012-09-30 Paul Eggert Merge from gnulib, incorporating: === modified file 'src/atimer.c' --- src/atimer.c 2012-09-27 01:06:23 +0000 +++ src/atimer.c 2012-10-04 00:10:47 +0000 @@ -42,7 +42,7 @@ /* The alarm timer and whether it was properly initialized, if POSIX timers are available. */ -#ifdef HAVE_TIMER_SETTIME +#ifdef HAVE_ITIMERSPEC static timer_t alarm_timer; static bool alarm_timer_ok; #endif @@ -296,7 +296,7 @@ #endif EMACS_TIME now, interval; -#ifdef HAVE_TIMER_SETTIME +#ifdef HAVE_ITIMERSPEC if (alarm_timer_ok) { struct itimerspec ispec; @@ -416,7 +416,7 @@ init_atimer (void) { struct sigaction action; -#ifdef HAVE_TIMER_SETTIME +#ifdef HAVE_ITIMERSPEC struct sigevent sigev; sigev.sigev_notify = SIGEV_SIGNAL; sigev.sigev_signo = SIGALRM; === modified file 'src/profiler.c' --- src/profiler.c 2012-10-02 19:38:10 +0000 +++ src/profiler.c 2012-10-04 00:10:47 +0000 @@ -204,7 +204,7 @@ /* The profiler timer and whether it was properly initialized, if POSIX timers are available. */ -#ifdef HAVE_TIMER_SETTIME +#ifdef HAVE_ITIMERSPEC static timer_t profiler_timer; static bool profiler_timer_ok; #endif @@ -240,7 +240,7 @@ { Lisp_Object oquit; EMACS_INT count = 1; -#ifdef HAVE_TIMER_SETTIME +#ifdef HAVE_ITIMERSPEC if (profiler_timer_ok) { int overruns = timer_getoverrun (profiler_timer); @@ -288,7 +288,7 @@ emacs_sigaction_init (&action, deliver_profiler_signal); sigaction (SIGPROF, &action, 0); -#ifdef HAVE_TIMER_SETTIME +#ifdef HAVE_ITIMERSPEC if (! profiler_timer_ok) { /* System clocks to try, in decreasing order of desirability. */ @@ -322,14 +322,18 @@ { struct itimerspec ispec; ispec.it_value = ispec.it_interval = interval; - timer_settime (profiler_timer, 0, &ispec, 0); - return TIMER_SETTIME_RUNNING; + if (timer_settime (profiler_timer, 0, &ispec, 0) == 0) + return TIMER_SETTIME_RUNNING; } #endif +#ifdef HAVE_SETITIMER timer.it_value = timer.it_interval = make_timeval (interval); - setitimer (ITIMER_PROF, &timer, 0); - return SETITIMER_RUNNING; + if (setitimer (ITIMER_PROF, &timer, 0) == 0) + return SETITIMER_RUNNING; +#endif + + return NOT_RUNNING; } DEFUN ("profiler-cpu-start", Fprofiler_cpu_start, Sprofiler_cpu_start, @@ -367,7 +371,7 @@ case NOT_RUNNING: return Qnil; -#ifdef HAVE_TIMER_SETTIME +#ifdef HAVE_ITIMERSPEC case TIMER_SETTIME_RUNNING: { struct itimerspec disable; @@ -377,6 +381,7 @@ break; #endif +#ifdef HAVE_SETITIMER case SETITIMER_RUNNING: { struct itimerval disable; @@ -384,6 +389,7 @@ setitimer (ITIMER_PROF, &disable, 0); } break; +#endif } signal (SIGPROF, SIG_IGN); === modified file 'src/syssignal.h' --- src/syssignal.h 2012-10-01 22:12:44 +0000 +++ src/syssignal.h 2012-10-04 00:10:47 +0000 @@ -29,8 +29,12 @@ #define FORWARD_SIGNAL_TO_MAIN_THREAD #endif -#if (defined SIGPROF && (defined HAVE_TIMER_SETTIME || defined HAVE_SETITIMER) \ - && !defined PROFILING) +#if defined HAVE_TIMER_SETTIME && defined SIGEV_SIGNAL +# define HAVE_ITIMERSPEC +#endif + +#if (defined SIGPROF && !defined PROFILING \ + && (defined HAVE_SETITIMER || defined HAVE_ITIMERSPEC)) # define PROFILER_CPU_SUPPORT #endif ------------------------------------------------------------ revno: 110353 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Wed 2012-10-03 18:53:09 -0300 message: Fix cornercase for string syntax. * progmodes/python.el (python-syntax-propertize-function): Simplify and enhance the regexp for unescaped quotes. Now it also matches quotes in weird situations like the single quote in "something\"'". (python-syntax-stringify): Simplify num-quotes detecting code. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-03 16:15:04 +0000 +++ lisp/ChangeLog 2012-10-03 21:53:09 +0000 @@ -1,3 +1,12 @@ +2012-10-03 Fabián Ezequiel Gallina + + Fix cornercase for string syntax. + * progmodes/python.el (python-syntax-propertize-function): + Simplify and enhance the regexp for unescaped quotes. Now it also + matches quotes in weird situations like the single quote in + "something\"'". + (python-syntax-stringify): Simplify num-quotes detecting code. + 2012-10-03 Glenn Morris * help-macro.el (three-step-help): === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-10-01 00:53:44 +0000 +++ lisp/progmodes/python.el 2012-10-03 21:53:09 +0000 @@ -499,16 +499,15 @@ (defconst python-syntax-propertize-function (syntax-propertize-rules ((rx - (or (and - ;; Match even number of backslashes. - (or (not (any ?\\ ?\' ?\")) point) (* ?\\ ?\\) - ;; Match single or triple quotes of any kind. - (group (or "\"" "\"\"\"" "'" "'''"))) - (and - ;; Match odd number of backslashes. - (or (not (any ?\\)) point) ?\\ (* ?\\ ?\\) - ;; Followed by even number of equal quotes. - (group (or "\"\"" "\"\"\"\"" "''" "''''"))))) + (and + ;; Match even number of backslashes. + (or (not (any ?\\ ?\' ?\")) point + ;; Quotes might be preceeded by a escaped quote. + (and (or (not (any ?\\)) point) ?\\ + (* ?\\ ?\\) (any ?\' ?\"))) + (* ?\\ ?\\) + ;; Match single or triple quotes of any kind. + (group (or "\"" "\"\"\"" "'" "'''")))) (0 (ignore (python-syntax-stringify)))))) (defsubst python-syntax-count-quotes (quote-char &optional point limit) @@ -525,12 +524,7 @@ (defun python-syntax-stringify () "Put `syntax-table' property correctly on single/triple quotes." - (let* ((num-quotes - (let ((n (length (or (match-string-no-properties 1) - (match-string-no-properties 2))))) - ;; This corrects the quote count when matching odd number - ;; of backslashes followed by even number of quotes. - (or (and (= 1 (logand n 1)) n) (1- n)))) + (let* ((num-quotes (length (match-string-no-properties 1))) (ppss (prog2 (backward-char num-quotes) (syntax-ppss) ------------------------------------------------------------ revno: 110352 fixes bug: http://debbugs.gnu.org/12567 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-03 09:15:04 -0700 message: * lisp/help-macro.el (three-step-help): Revert 2012-09-29 change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-03 08:50:49 +0000 +++ lisp/ChangeLog 2012-10-03 16:15:04 +0000 @@ -1,3 +1,8 @@ +2012-10-03 Glenn Morris + + * help-macro.el (three-step-help): + Revert 2012-09-29 change. (Bug#12567) + 2012-10-03 Martin Rudalics * menu-bar.el (kill-this-buffer): Don't do anything when === modified file 'lisp/help-macro.el' --- lisp/help-macro.el 2012-09-29 18:21:45 +0000 +++ lisp/help-macro.el 2012-10-03 16:15:04 +0000 @@ -69,6 +69,11 @@ (require 'backquote) +;; This needs to be autoloaded because it is used in the +;; make-help-screen macro. Using (bound-and-true-p three-step-help) +;; is not an acceptable alternative, because nothing loads help-macro +;; in a normal session, so any user customization would never be applied. +;;;###autoload (defcustom three-step-help nil "Non-nil means give more info about Help command in three steps. The three steps are simple prompt, prompt with all options, and ------------------------------------------------------------ revno: 110351 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-10-03 10:50:49 +0200 message: Have kill-this-buffer don't do anything when frame is not alive or visible (Bug#8184). * menu-bar.el (kill-this-buffer): Don't do anything when `menu-frame' is not alive or visible (Bug#8184). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-03 07:18:50 +0000 +++ lisp/ChangeLog 2012-10-03 08:50:49 +0000 @@ -1,5 +1,8 @@ 2012-10-03 Martin Rudalics + * menu-bar.el (kill-this-buffer): Don't do anything when + `menu-frame' is not alive or visible (Bug#8184). + * emacs-lisp/debug.el (debug): When quitting the debugger window restore current buffer (Bug#12502). === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2012-08-07 16:12:20 +0000 +++ lisp/menu-bar.el 2012-10-03 08:50:49 +0000 @@ -1812,9 +1812,14 @@ When called in the minibuffer, get out of the minibuffer using `abort-recursive-edit'." (interactive) - (if (menu-bar-non-minibuffer-window-p) - (kill-buffer (current-buffer)) - (abort-recursive-edit))) + (cond + ;; Don't do anything when `menu-frame' is not alive or visible + ;; (Bug#8184). + ((not (menu-bar-menu-frame-live-and-visible-p))) + ((menu-bar-non-minibuffer-window-p) + (kill-buffer (current-buffer))) + (t + (abort-recursive-edit)))) (defun kill-this-buffer-enabled-p () "Return non-nil if the `kill-this-buffer' menu item should be enabled." ------------------------------------------------------------ revno: 110350 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-10-03 09:18:50 +0200 message: In debug restore current buffer when quitting debugger window (Bug#12502). * emacs-lisp/debug.el (debug): When quitting the debugger window restore current buffer (Bug#12502). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-02 15:21:47 +0000 +++ lisp/ChangeLog 2012-10-03 07:18:50 +0000 @@ -1,3 +1,8 @@ +2012-10-03 Martin Rudalics + + * emacs-lisp/debug.el (debug): When quitting the debugger window + restore current buffer (Bug#12502). + 2012-10-02 Chong Yidong * progmodes/hideif.el (hif-lookup, hif-defined): Handle === modified file 'lisp/emacs-lisp/debug.el' --- lisp/emacs-lisp/debug.el 2012-09-20 13:35:13 +0000 +++ lisp/emacs-lisp/debug.el 2012-10-03 07:18:50 +0000 @@ -273,7 +273,9 @@ (setq debugger-previous-window-height (window-total-size debugger-window)) ;; Unshow debugger-buffer. - (quit-restore-window debugger-window debugger-bury-or-kill)) + (quit-restore-window debugger-window debugger-bury-or-kill) + ;; Restore current buffer (Bug#12502). + (set-buffer debugger-old-buffer)) ;; Restore previous state of debugger-buffer in case we were ;; in a recursive invocation of the debugger, otherwise just ;; erase the buffer and put it into fundamental mode. ------------------------------------------------------------ revno: 110349 committer: Paul Eggert branch nick: trunk timestamp: Tue 2012-10-02 12:38:10 -0700 message: * profiler.c (handle_profiler_signal): Fix a malloc race that caused Emacs to hang on Fedora 17 when profiling Lisp. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-02 18:51:51 +0000 +++ src/ChangeLog 2012-10-02 19:38:10 +0000 @@ -1,3 +1,8 @@ +2012-10-02 Paul Eggert + + * profiler.c (handle_profiler_signal): Fix a malloc race + that caused Emacs to hang on Fedora 17 when profiling Lisp. + 2012-10-02 Jan Djärv * nsterm.m (windowDidEnterFullScreen): Remove fprintf. === modified file 'src/profiler.c' --- src/profiler.c 2012-10-02 06:30:40 +0000 +++ src/profiler.c 2012-10-02 19:38:10 +0000 @@ -238,6 +238,7 @@ cpu_gc_count = saturated_add (cpu_gc_count, 1); else { + Lisp_Object oquit; EMACS_INT count = 1; #ifdef HAVE_TIMER_SETTIME if (profiler_timer_ok) @@ -247,8 +248,16 @@ count += overruns; } #endif + /* record_backtrace uses hash functions that call Fequal, which + uses QUIT, which can call malloc, which can cause disaster in + a signal handler. So inhibit QUIT. */ + oquit = Vinhibit_quit; + Vinhibit_quit = Qt; + eassert (HASH_TABLE_P (cpu_log)); record_backtrace (XHASH_TABLE (cpu_log), count); + + Vinhibit_quit = oquit; } }