Subject: bug#3261: 23.0.93; minor vc-dir initialization bug

From: Bob Rogers <[email-masked]>
Date: Mon, 11 May 2009 22:30:07 -0400 (EDT)

To reproduce in Emacs trunk (as of Friday):

   1.  "emacs -Q" in a VC directory, preferably one in which updates
take more than a few seconds (large tree, distant/slow server, or both).

   2.  "C-x v d" to get into the *vc-dir* buffer, and *immediately* type
"n" (vc-dir-next-line) before the buffer has any file lines.

   This gives me a "wrong type argument" error (backtrace below) when
ewoc-goto-node tries to treat "nil" as a node.  The tweak to
ewoc-goto-next (below the backtrace) produces a better error message,
but is still too generic.

					-- Bob Rogers
					   http://www.rgrjr.com/

========================================================================

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  ewoc-goto-node([cl-struct-ewoc #<buffer *vc-dir*> (lambda (&rest --cl-rest--) (apply #[... "J	!=3fff88=3fffc2c=3fff87" [G39800 data "\n"] 2] ... --cl-rest--)) [[[#1 #2 "" #<marker at 114 in *vc-dir*>] #1 DL-LIST #<marker at 115 in *vc-dir*>] [#1 [#2 #1 DL-LIST #<marker at 115 in *vc-dir*>] "" #<marker at 114 in *vc-dir*>] #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] [[[#1 #2 DL-LIST #<marker at 115 in *vc-dir*>] #1 #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] [#1 [#2 #1 #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<m
 arker at 1 in *vc-dir*>] DL-LIST #<marker at 115 in *vc-dir*>] "" #<marker at 114 in *vc-dir*>] [[[#1 #2 #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] #1 "" #<marker at 114 in *vc-dir*>] [#1 [#2 #1 "" #<marker at 114 in *vc-dir*>] #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] DL-LIST #<marker at 115 in *vc-dir*>] nil (lambda (&rest --cl-rest--) (apply #[... "J	!=3fff88=3fffc2c=3fff87" [G39800 data "\n"] 2] ... --cl-rest--))] nil)
  ewoc-goto-next([cl-struct-ewoc #<buffer *vc-dir*> (lambda (&rest --cl-rest--) (apply #[... "J	!=3fff88=3fffc2c=3fff87" [G39800 data "\n"] 2] ... --cl-rest--)) [[[#1 #2 "" #<marker at 114 in *vc-dir*>] #1 DL-LIST #<marker at 115 in *vc-dir*>] [#1 [#2 #1 DL-LIST #<marker at 115 in *vc-dir*>] "" #<marker at 114 in *vc-dir*>] #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] [[[#1 #2 DL-LIST #<marker at 115 in *vc-dir*>] #1 #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] [#1 [#2 #1 #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<m
 arker at 1 in *vc-dir*>] DL-LIST #<marker at 115 in *vc-dir*>] "" #<marker at 114 in *vc-dir*>] [[[#1 #2 #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] #1 "" #<marker at 114 in *vc-dir*>] [#1 [#2 #1 "" #<marker at 114 in *vc-dir*>] #("VC backend : SVN\nWorking dir: /shared.local/mgi/modest/\nRepository : https://www.modulargenetics.com/svn/modest\n" 0 13 ... 13 17 ... 17 30 ... 30 56 ... 56 69 ... 69 111 ...) #<marker at 1 in *vc-dir*>] DL-LIST #<marker at 115 in *vc-dir*>] nil (lambda (&rest --cl-rest--) (apply #[... "J	!=3fff88=3fffc2c=3fff87" [G39800 data "\n"] 2] ... --cl-rest--))] 1)
  vc-dir-next-line(1)
  call-interactively(vc-dir-next-line nil nil)

===================================================================
Patch:
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/ewoc.el,v
retrieving revision 1.47
diff -u -r1.47 ewoc.el
--- lisp/emacs-lisp/ewoc.el	5 Jan 2009 03:21:00 -0000	1.47
+++ lisp/emacs-lisp/ewoc.el	12 May 2009 02:21:47 -0000
@@ -496,6 +496,8 @@
     ;; Never step below the first element.
     ;; (unless (ewoc--filter-hf-nodes ewoc node)
     ;;   (setq node (ewoc--node-nth dll -2)))
+    (unless node
+      (error "No next."))
     (ewoc-goto-node ewoc node)))
 
 (defun ewoc-goto-node (ewoc node)
========================================================================

In GNU Emacs 23.0.93.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2009-05-08 on rgr
Windowing system distributor `The X.Org Foundation', version 11.0.10400090
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t