unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
@ 2014-04-28 20:55 Jon Dufresne
  2014-04-29 14:09 ` Glenn Morris
  2014-04-29 16:29 ` Glenn Morris
  0 siblings, 2 replies; 10+ messages in thread
From: Jon Dufresne @ 2014-04-28 20:55 UTC (permalink / raw)
  To: 17365

The following recipe causes Emacs to hang 100%.

0. Start in a mercurial repository directory.
1. Run "emacs -Q -l /path/to/test.el"
2. M-x project-compile-and-visit-tags-table
3. Wait for completion.
4. M-x project-compile-and-visit-tags-table
5. Receive prompt: "Tags file /path/to/TAGS has changed, read new
contents? (yes or no)"
6. Type "yes"
7. Emacs hangs, must send kill signal to close.

The goal of test.el is to re-compile and visit the TAGS file while
coexisting with fci-mode. If there is a better way to accomplish the
same thing, I'd be interested to know.

It is possible that this is a bug in fci-mode, however, it seems to me
that a buggy third party script should not be capable of freezing the
entire Emacs process, so I am filing it here. Removing fci-mode removes
the freezing.

The test.el:

---
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(package-refresh-contents)
(package-install 'fill-column-indicator)

(require 'fill-column-indicator)
(setq-default fci-rule-column 80)
(defun fci-mode-on ()
  "Turn fci-mode on."
  (fci-mode 1))
(define-globalized-minor-mode global-fci-mode
  fci-mode
  fci-mode-on)
(global-fci-mode 1)

(defun project-compile-and-visit-tags-table ()
  "Compile TAGS file at the project ROOT directory."
  (interactive)
  (let ((root (project-root)))
    (when root
      (add-hook 'compilation-finish-functions #'project-visit-tags-table)
      (compile (format "ctags -e -R --exclude=updates --languages=PHP -o %s %s"
                       (concat root "TAGS") root)))))

(defun project-visit-tags-table (buffer string)
  "Tell tags commands to use tags table at the project root."
  (when (string= string "finished\n")
    (visit-tags-table (concat (project-root) "TAGS")))
  (remove-hook 'compilation-finish-functions #'project-visit-tags-table))

(defun project-root ()
  "Return the project's root directory."
  (locate-dominating-file default-directory ".hg"))
---




In GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.8)
 of 2014-04-18 on buildvm-19.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11404000
System Description:	Fedora release 20 (Heisenbug)

Configured using:
 `configure '--build=x86_64-redhat-linux-gnu'
 '--host=x86_64-redhat-linux-gnu' '--program-prefix='
 '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
 '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include'
 '--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
 '--localstatedir=/var' '--sharedstatedir=/var/lib'
 '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus'
 '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
 '--with-xft' '--with-xpm' '--with-x-toolkit=gtk3' '--with-gpm=no'
 'build_alias=x86_64-redhat-linux-gnu'
 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
 -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o <tab> r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode easymenu time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-28 20:55 bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang Jon Dufresne
@ 2014-04-29 14:09 ` Glenn Morris
  2014-04-29 16:27   ` Jon Dufresne
  2014-04-29 16:29 ` Glenn Morris
  1 sibling, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2014-04-29 14:09 UTC (permalink / raw)
  To: Jon Dufresne; +Cc: 17365

Jon Dufresne wrote:

> It is possible that this is a bug in fci-mode, however, it seems to me
> that a buggy third party script should not be capable of freezing the
> entire Emacs process, so I am filing it here.

As a general comment, an external package can break Emacs in an infinite
number of ways, including making it freeze. That's just how it is.
(I haven't checked your specific issue.)





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-29 14:09 ` Glenn Morris
@ 2014-04-29 16:27   ` Jon Dufresne
  0 siblings, 0 replies; 10+ messages in thread
From: Jon Dufresne @ 2014-04-29 16:27 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 17365

On Tue, Apr 29, 2014 at 7:09 AM, Glenn Morris <rgm@gnu.org> wrote:
> As a general comment, an external package can break Emacs in an infinite
> number of ways, including making it freeze. That's just how it is.

I see, and understand.

I filed a ticket with the package maintainer as well which contains a
bit more information:
<https://github.com/alpaker/Fill-Column-Indicator/issues/49>

I have since tried this on trunk using the git mirror and the bug
still persists. In the end, if this is a bug in fci-mode and not
strictly Emacs, the package maintainer is very cooperative.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-28 20:55 bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang Jon Dufresne
  2014-04-29 14:09 ` Glenn Morris
@ 2014-04-29 16:29 ` Glenn Morris
  2014-04-29 16:48   ` Jon Dufresne
  1 sibling, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2014-04-29 16:29 UTC (permalink / raw)
  To: Jon Dufresne; +Cc: 17365

Jon Dufresne wrote:

> The following recipe causes Emacs to hang 100%.
>
> 0. Start in a mercurial repository directory.
> 1. Run "emacs -Q -l /path/to/test.el"
> 2. M-x project-compile-and-visit-tags-table
> 3. Wait for completion.
> 4. M-x project-compile-and-visit-tags-table
> 5. Receive prompt: "Tags file /path/to/TAGS has changed, read new
> contents? (yes or no)"
> 6. Type "yes"
> 7. Emacs hangs, must send kill signal to close.

I followed the recipe, but it doesn't hang for me.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-29 16:29 ` Glenn Morris
@ 2014-04-29 16:48   ` Jon Dufresne
  2014-04-29 18:10     ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Jon Dufresne @ 2014-04-29 16:48 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 17365

On Tue, Apr 29, 2014 at 9:29 AM, Glenn Morris <rgm@gnu.org> wrote:
> Jon Dufresne wrote:
>
>> The following recipe causes Emacs to hang 100%.
>>
>> 0. Start in a mercurial repository directory.
>> 1. Run "emacs -Q -l /path/to/test.el"
>> 2. M-x project-compile-and-visit-tags-table
>> 3. Wait for completion.
>> 4. M-x project-compile-and-visit-tags-table
>> 5. Receive prompt: "Tags file /path/to/TAGS has changed, read new
>> contents? (yes or no)"
>> 6. Type "yes"
>> 7. Emacs hangs, must send kill signal to close.
>
> I followed the recipe, but it doesn't hang for me.

Thanks for testing.

I have since done additional testing and the recipe, as stated is
insufficient. There is something specific in my working directory that
is causing this issue, and just any mercurial repository won't do. I
am currently trying to track down precisely what in the directory is
triggering the bug. When I have additional information I will report
it to this ticket. Unfortunately, I am unable to share the repository
required to trigger the issue.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-29 16:48   ` Jon Dufresne
@ 2014-04-29 18:10     ` Stefan Monnier
  2014-04-29 18:31       ` Jon Dufresne
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2014-04-29 18:10 UTC (permalink / raw)
  To: Jon Dufresne; +Cc: 17365

> I have since done additional testing and the recipe, as stated is
> insufficient. There is something specific in my working directory that
> is causing this issue, and just any mercurial repository won't do. I
> am currently trying to track down precisely what in the directory is
> triggering the bug. When I have additional information I will report
> it to this ticket. Unfortunately, I am unable to share the repository
> required to trigger the issue.

Please (setq debug-on-event 'sigusr2) and then use "kill -USR2 <pid>"
while Emacs is frozen, so as to try and get a backtrace, which will help
us figure out what Emacs is doing while "frozen",


        Stefan





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-29 18:10     ` Stefan Monnier
@ 2014-04-29 18:31       ` Jon Dufresne
  2014-04-29 19:10         ` Alp Aker
  0 siblings, 1 reply; 10+ messages in thread
From: Jon Dufresne @ 2014-04-29 18:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 17365

On Tue, Apr 29, 2014 at 11:10 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> Please (setq debug-on-event 'sigusr2) and then use "kill -USR2 <pid>"
> while Emacs is frozen, so as to try and get a backtrace, which will help
> us figure out what Emacs is doing while "frozen",

Debugger entered--Lisp error: (quit)
  fci-put-overlays-region(2807 7574591)
  fci-redraw-region(2807 7574565 0)
  insert-file-contents("/home/jon/devel/erezlife/development/TAGS" t nil nil t)
  revert-buffer-insert-file-contents--default-function("/home/jon/devel/erezlife/development/TAGS"
nil)
  revert-buffer--default(t t)
  revert-buffer(t t)
  tags-verify-table("/home/jon/devel/erezlife/development/TAGS")
  visit-tags-table-buffer("~/devel/erezlife/development/TAGS")
  visit-tags-table("~/devel/erezlife/development/TAGS")
  (progn (visit-tags-table (concat (project-root) "TAGS")))
  (if (string= string "finished\n") (progn (visit-tags-table (concat
(project-root) "TAGS"))))
  project-visit-tags-table(#<buffer *compilation*> "finished\n")
  run-hook-with-args(project-visit-tags-table #<buffer *compilation*>
"finished\n")
  compilation-handle-exit(exit 0 "finished\n")
  compilation-sentinel(#<process compilation> "finished\n")





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-29 18:31       ` Jon Dufresne
@ 2014-04-29 19:10         ` Alp Aker
  2014-04-29 19:16           ` Jon Dufresne
  0 siblings, 1 reply; 10+ messages in thread
From: Alp Aker @ 2014-04-29 19:10 UTC (permalink / raw)
  To: Jon Dufresne; +Cc: 17365

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

> Debugger entered--Lisp error: (quit)
>
>      fci-put-overlays-region(2807 7574591)
>      fci-redraw-region(2807 7574565 0)
>      insert-file-contents("/home/jon/devel/erezlife/development/TAGS" t
nil nil t)
>
revert-buffer-insert-file-contents--default-function("/home/jon/devel/erezlife/development/TAGS"
>    nil)
>      revert-buffer--default(t t)
>      revert-buffer(t t)

I'm the author of the package in question.  This is, I think, a use case I
hadn't considered.

Jon, could you replace the definition of fci-redraw-region with the
following and try your recipe again?

(defun fci-redraw-region (start end _ignored)
  (when (fci-get-buffer-windows t)
    (save-match-data
      (save-excursion
        (let ((inhibit-point-motion-hooks t))
          (goto-char end)
          (setq end (line-beginning-position 2))
          (fci-delete-overlays-region start end)
          (fci-put-overlays-region start end))))))

[-- Attachment #2: Type: text/html, Size: 1205 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-29 19:10         ` Alp Aker
@ 2014-04-29 19:16           ` Jon Dufresne
  2014-04-29 20:38             ` Alp Aker
  0 siblings, 1 reply; 10+ messages in thread
From: Jon Dufresne @ 2014-04-29 19:16 UTC (permalink / raw)
  To: Alp Aker; +Cc: 17365

On Tue, Apr 29, 2014 at 12:10 PM, Alp Aker <alptekin.aker@gmail.com> wrote:
> Jon, could you replace the definition of fci-redraw-region with the
> following and try your recipe again?
>
> (defun fci-redraw-region (start end _ignored)
>   (when (fci-get-buffer-windows t)
>     (save-match-data
>       (save-excursion
>         (let ((inhibit-point-motion-hooks t))
>           (goto-char end)
>           (setq end (line-beginning-position 2))
>           (fci-delete-overlays-region start end)
>           (fci-put-overlays-region start end))))))
>
>

This worked! After adding this function Emacs no longer hangs after
entering "yes".

Thank you very much for the prompt response.

The full working recipe now appears as follows:

---
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(package-refresh-contents)
(package-install 'fill-column-indicator)

(setq debug-on-event 'sigusr2)

(require 'fill-column-indicator)
(setq-default fci-rule-column 80)
(defun fci-mode-on ()
  "Turn fci-mode on."
  (fci-mode 1))
(define-globalized-minor-mode global-fci-mode
  fci-mode
  fci-mode-on)
(global-fci-mode 1)

(defun fci-redraw-region (start end _ignored)
  (when (fci-get-buffer-windows t)
    (save-match-data
      (save-excursion
        (let ((inhibit-point-motion-hooks t))
          (goto-char end)
          (setq end (line-beginning-position 2))
          (fci-delete-overlays-region start end)
          (fci-put-overlays-region start end))))))

(defun project-compile-and-visit-tags-table ()
  "Compile TAGS file at the project ROOT directory."
  (interactive)
  (let ((root (project-root)))
    (when root
      (add-hook 'compilation-finish-functions #'project-visit-tags-table)
      (compile (format "ctags -e -R --languages=PHP -o %s %s"
                       (concat root "TAGS") root)))))

(defun project-visit-tags-table (buffer string)
  "Tell tags commands to use tags table at the project root."
  (when (string= string "finished\n")
    (visit-tags-table (concat (project-root) "TAGS")))
  (remove-hook 'compilation-finish-functions #'project-visit-tags-table))

(defun project-root ()
  "Return the project's root directory."
  (locate-dominating-file default-directory ".hg"))
---





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang
  2014-04-29 19:16           ` Jon Dufresne
@ 2014-04-29 20:38             ` Alp Aker
  0 siblings, 0 replies; 10+ messages in thread
From: Alp Aker @ 2014-04-29 20:38 UTC (permalink / raw)
  To: Jon Dufresne; +Cc: 17365-done

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

> This worked! After adding this function Emacs no longer hangs after
> entering "yes".

Great.  I'll follow up later with a real fix on the package's buglist
(since this isn't an Emacs bug).

Closing this.

[-- Attachment #2: Type: text/html, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-04-29 20:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-28 20:55 bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang Jon Dufresne
2014-04-29 14:09 ` Glenn Morris
2014-04-29 16:27   ` Jon Dufresne
2014-04-29 16:29 ` Glenn Morris
2014-04-29 16:48   ` Jon Dufresne
2014-04-29 18:10     ` Stefan Monnier
2014-04-29 18:31       ` Jon Dufresne
2014-04-29 19:10         ` Alp Aker
2014-04-29 19:16           ` Jon Dufresne
2014-04-29 20:38             ` Alp Aker

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).