[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tree-grafting bug in Ebrowse.

From: Alan Mackenzie
Subject: Tree-grafting bug in Ebrowse.
Date: Tue, 11 Jan 2005 20:26:57 +0000 (GMT)

Hi, everybody!

There is a bug in ebrowse which is triggered by having a top level class
represented twice in the BROWSE structure.  The intention of the code is
to overwrite the first expression of the class by the second.  In the
existing code this doesn't work, because a searching function
`ebrowse-class-in-tree' returns the _contents_ of the node found, rather
than it's position in the list, thus making it impossible to overwrite
the list structure.  

I don't know the precise circumstances which cause such a tree to be
generated in BROWSE, so I can't supply a test case.  Unfortunately, the
project I get paid for working on has an ideal set of source files for
discovering glitches in class browsers.  ;-(

Here is a patch for the bug.  I have also appended somebody else's bug
report from 2001 for the same bug.

Would somebody please verify and install this patch.


2005-01-11  Alan Mackenzie  <address@hidden>

        * ebrowse.el (ebrowse-class-in-tree): Return the tail of the tree
        rather than the element found, thus enabling the tree to be

*** ebrowse-1.25.el     Tue Jan 11 18:54:55 2005
--- ebrowse-1.25.acm.el Tue Jan 11 20:02:53 2005
*** 780,795 ****
  (defun ebrowse-class-in-tree (class tree)
    "Search for a class with name CLASS in TREE.
! Return the class found, if any.  This function is used during the load
! phase where classes appended to a file replace older class
! information."
    (let ((tclass (ebrowse-ts-class class))
      (while (and tree (not found))
!       (let ((root (car tree)))
!       (when (string= (ebrowse-qualified-class-name (ebrowse-ts-class root))
                       (ebrowse-qualified-class-name tclass))
!         (setq found root))
        (setq tree (cdr tree))))
--- 780,795 ----
  (defun ebrowse-class-in-tree (class tree)
    "Search for a class with name CLASS in TREE.
! If CLASS is found, return the tail of TREE starting at CLASS.  This function
! is used during the load phase where classes appended to a file replace older
! class information."
    (let ((tclass (ebrowse-ts-class class))
      (while (and tree (not found))
!       (let ((root-ptr tree))
!       (when (string= (ebrowse-qualified-class-name (ebrowse-ts-class (car 
                       (ebrowse-qualified-class-name tclass))
!         (setq found root-ptr))
        (setq tree (cdr tree))))
*** 903,912 ****
      (let ((gc-cons-threshold 2000000))
        (while (not (progn (skip-chars-forward " \t\n\r") (eobp)))
        (let* ((root (read (current-buffer)))
!              (old-root (ebrowse-class-in-tree root tree)))
          (ebrowse-show-progress "Reading data" (null tree))
!         (if old-root
!             (setf (car old-root) root)
            (push root tree)))))
      (list header tree)))
--- 903,912 ----
      (let ((gc-cons-threshold 2000000))
        (while (not (progn (skip-chars-forward " \t\n\r") (eobp)))
        (let* ((root (read (current-buffer)))
!              (old-root-ptr (ebrowse-class-in-tree root tree)))
          (ebrowse-show-progress "Reading data" (null tree))
!         (if old-root-ptr
!             (setcar old-root-ptr root)
            (push root tree)))))
      (list header tree)))


>From address@hidden Tue Jan 11 20:10:40 2005
Message-ID: <address@hidden>
From: address@hidden (deja8501)
Newsgroups: gnu.emacs.help
Subject: Re: ebrowse doesn't work
Date: 9 Nov 2001 03:06:44 -0800
References: <address@hidden> <address@hidden>
Lines: 55
Organization: http://groups.google.com/
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1005304004 16075 (9 Nov 2001 11:06:44 GMT)
X-Complaints-To: address@hidden
NNTP-Posting-Date: 9 Nov 2001 11:06:44 GMT
Xref: acm.acm gnu.emacs.help:10981

Eli Zaretskii <address@hidden> wrote in message news:<address@hidden>...
> deja8501 wrote:
> > 
> > I created the BROWSE file and tried to visit it, but emacs signalled
> > an error and visited the file literally.
> > 
> > The error message was something like the contents of the BROWSE file:
> > 
> >    File mode specification error: wrong type of argument consp [ebrowse-ts [
> Does this happen with any file you run through ebrowse--any file at all,
> even a trivial one-liner?  If not, please post the minimal file with which
> you see this, and the exact sequence of commands you typed to reproduce
> the problem.

I tried with one file instead of all. It worked.

I managed to catch the error message in the lots-of-file case:

File mode specification error: (wrong-type-argument consp [ebrowse-ts
[ebrowse-cs "log" "client::gui" 0 nil nil 0
"./client/gui/corba/EventImpl.cc"] nil ([ebrowse-ms "Logger" nil 0 nil
nil 0 0 "./client/gui/log/Logger.cc" "using client::gui::log::Logger;"
106] [ebrowse-ms "LoggerImpl" nil 0 nil nil 0 0
"./client/gui/log/Logger.cc" "using client::gui::log::LoggerImpl;"
153]) nil nil nil nil nil nil nil])

The application uses namespaces massively (separate namespace for
every directory), maybe that's why ebrowse chokes on it.

I'll post a minimal file when I come up with one.

> > I can't tell you the exact error message, since it is not written into
> > the *Messages* buffer and the message disappears within a second.
> > 
> > (Is it a new feature in emacs21? As far as I remember emacs20 wrote
> > every error into *Messages* while emacs21 records user-level messages
> > only for me.)
> > 
> > I tried M-x toggle-debug-on-error, but it didn't help. The error
> > message still vanishes after a second.
> Does this happen in "emacs -q --no-site-file"?

No. I always forget to check it. :)

I seems that the sexp (standard-display-european t) which has always
been in my .emacs caused the problem. I know that it's obsoleted. When
it is in my .emacs then only the first character (F) of the error
message above is written into the *Messages* buffer.



Alan Mackenzie (Munich, Germany)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]