Hi. I have been using BBDB with Gnus for a while, with the multiple
records in BBDB feature activated. This is /very/ nice for dealing with
the two "Andrew Phillips" that I have as friends. :)

Anyway, recently, I have been getting this stack trace when trying to
show the mark for them:

,----[ BBDB multiple records backtrace ]
|   car(["Andrew" "Phillips" nil nil nil nil ("[EMAIL PROTECTED]") 
|((creation-date . "2001-03-21") (timestamp . "2001-03-21")) ["Andrew Phillips" nil 
|#<marker at 66306 in .bbdb 0x8c9ec5c> nil]])
|   (let ((name-rec ...) (nets net-recs)) (while nets (if ... ... ...)) (if name-recs 
|(setq name-recs ...) name-rec))
|   (while name-recs (let (... ...) (while nets ...) (if name-recs ... name-rec)))
|   (if (not (and name-recs net-recs)) (or (and name-recs ...) (and net-recs ...)) 
|(while name-recs (let ... ... ...)) ret)
|   (let ((name-recs ...) (net-recs ...) ret) (if (not ...) (or ... ...) (while 
|name-recs ...) ret))
|   bbdb-search-simple("Andrew Phillips" "[EMAIL PROTECTED]")
|   (setq record (bbdb-search-simple name (if ... ... net)))
|   (and data (setq record (bbdb-search-simple name ...)))
|   (if (and data (setq record ...)) (or (bbdb-record-getprop record 
|bbdb-message-marker-field) bbdb/gnus-summary-known-poster-mark) " ")
|   (let* ((from ...) (data ...) (name ...) (net ...) record) (if (and data ...) (or 
|... bbdb/gnus-summary-known-poster-mark) " "))
|   gnus-user-format-function-b([2071 "Hmmmm." "Andrew Phillips <[EMAIL PROTECTED]>" 
|"Tue, 27 Feb 2001 10:49:12 +1100" 
|"<[EMAIL PROTECTED]>" "" 301 13 "localhost 
|Inbox.cabal:2071" ((To . "[EMAIL PROTECTED]") (Keywords . "cabal"))])
| 
| [...]
`----

The trace is elided at the point Gnus is formatting the summary line
string. If you care for the Gnus part of it, let me know.

The specific problem is this code is `bbdb-simple-search':

  (let ((name-recs (if name ;; filter out companies from hash
                       (let ((recs (bbdb-gethash (downcase name)))
                             answer)
                         (while recs
                           (let ((n-rec (car recs)))
                             (if (string= (downcase name)
                                          (downcase (bbdb-record-name n-rec)))
                                 (setq answer (append recs n-rec)))
                             (setq recs (cdr recs))))
                         answer)))


Specifically, because there are two records that match "Andrew Phillips"
in the database, the walk through the records is done.

The second call to `(setq answer (append recs n-rec))' results in
`answer' being a *dotted* list of records.

This can be seen by executing `(let ((l '(one))) (append l 'two))'


Later, the code does:

      (while name-recs
        (let ((name-rec (car name-recs))
              (nets     net-recs))
          (while nets
            (if (eq (car nets) name-rec)
                (setq nets      '()
                      name-recs '()
                      ret name-rec)
              (setq nets (cdr nets))))
          (if name-recs (setq name-recs (cdr name-recs))
              name-rec)))

Because `name-recs' was bound to `answer' from the above fragment, which
is a dotted list, the line:

(if name-recs (setq name-recs (cdr name-recs)))

is executed. The `cdr' call returns the second element as is, *not* as a
list.

This can be seen by evaluating `(car '(one . two))'.

As a result, when the code loops to :

        (let ((name-rec (car name-recs))

name-recs is /not/ a list, just a single element.

This causes the stack trace.

I have verified that the underlying behaviour is identical in Emacs
20.7.2 on my machine, Linux 2.4 running Debian/unstable.

XEmacs is, of course, from CVS.


I hope this is enough detail for someone who understands this code to
correct the error. This started failing fairly recently, but is still a
problem in the latest CVS.

        Daniel


Emacs  : XEmacs 21.2  (beta46) "Urania" [Lucid] (i686-pc-linux, Mule) of Thu Mar 22 
2001 on inanna
Package: BBDB 2.33

current state:
==============
(setq
 bbdb-version-date "$Date: 2001/03/17 17:23:46 $"
 bbdb-file-format 6
 bbdb-no-duplicates-p nil
 bbdb-after-change-hook '(bbdb/gnus-score-invalidate-alist)
 bbdb-after-read-db-hook nil
 bbdb-always-add-addresses nil
 bbdb-auto-notes-alist '(("X-face" (".*" face 0)) ("Organization" 
("\\s-*\\(.*\\)\\s-*" company 1))
                         ("Organisation" ("\\s-*\\(.*\\)\\s-*" company 1))
                         ("X-Organization" ("\\s-*\\(.*\\)\\s-*" company 1))
                         ("X-Organisation" ("\\s-*\\(.*\\)\\s-*" company 1)) ("Web" 
("\\s-*\\(.*\\)\\s-*" url 1))
                         ("X-Web" ("\\s-*\\(.*\\)\\s-*" url 1)) ("X-WWW-Homepage" 
("\\s-*\\(.*\\)\\s-*" url 1))
                         ("X-WWW-page" ("\\s-*\\(.*\\)\\s-*" url 1)) ("X-Homepage" 
("\\s-*\\(.*\\)\\s-*" url 0))
                         ("X-Url" ("\\s-*\\(.*\\)\\s-*" last-url 1)) ("X-Mailer" 
("\\s-*\\(.*\\)\\s-*" mailer 1 t))
                         ("X-Newsreader" ("\\s-*\\(.*\\)\\s-*" mailer 1 t)) ("X-Mua" 
("\\s-*\\(.*\\)\\s-*" mailer 1 t))
                         ("X-ICQ" ("\\s-*\\([0-9]+\\)\\s-*" icq 1)))
 bbdb-auto-revert-p nil
 bbdb-canonicalize-net-hook 'dp:bbdb-rewrite-address
 bbdb-canonicalize-redundant-nets-p t
 bbdb-case-fold-search t
 bbdb-change-hook '(bbdb-delete-redundant-nets bbdb-timestamp-hook)
 bbdb-completion-display-record t
 bbdb-completion-type nil
 bbdb-create-hook 'bbdb-creation-date-hook
 bbdb-default-area-code nil
 bbdb-define-all-aliases-field 'mail-alias
 bbdb-dial-local-prefix nil
 bbdb-dial-local-prefix-alist '(((if bbdb-default-area-code (format "(%03d)" 
bbdb-default-area-code) "") ""))
 bbdb-dial-long-distance-prefix nil
 bbdb-dwim-net-address-allow-redundancy nil
 bbdb-electric-p nil
 bbdb-elided-display nil
 bbdb-extract-address-component-handler 'message
 bbdb-extract-address-component-ignore-regexp 
"\\(\\(undisclosed\\|unlisted\\)[^,]*recipients\\)\\|no To-header on input"
 bbdb-extract-address-component-regexps '(("\"'\\([^\"]*\\)'\"\\s-*<\\([^>]+\\)>"
                                           (bbdb-clean-username (match-string 1 
adstring)) 2)
                                          ("\"\\([^\"]*\\)\"\\s-*<\\([^>]+\\)>"
                                           (bbdb-clean-username (match-string 1 
adstring)) 2)
                                          ("\\(\\b[^<,]*\\b\\)\\s-*<\\([^>]+\\)>" 1 2) 
("<\\([^>]+\\)>" nil 2)
                                          ("\\(\\b[^<\",()]+\\b\\)\\s-*(\\([^)]+\\))" 
2 1)
                                          
("\\b\\(\\([^@]+\\.[^@]+\\)@[0-9a-z._-]+\\)\\b"
                                           (bbdb-clean-username (match-string 2 
adstring)) 1)
                                          
("\\b\\(\\([0-9a-z._-]+\\)@[0-9a-z._-]+\\)\\b" nil 1)
                                          ("\\b\\([0-9a-z._-]+\\)\\b" nil 1))
 bbdb-file "~/.bbdb"
 bbdb-file-remote nil
 bbdb-file-remote-save-always t
 bbdb-finger-host-field 'finger-host
 bbdb-get-addresses-from-headers '("From" "Resent-From" "Reply-To")
 bbdb-get-addresses-headers '("From" "Resent-From" "Reply-To" "Resent-To" "Resent-CC" 
"To" "CC" "BCC")
 bbdb-get-addresses-to-headers '("Resent-To" "Resent-CC" "To" "CC" "BCC")
 bbdb-get-only-first-address-p nil
 bbdb-gui t
 bbdb-hashtable-size 1021
 bbdb-ignore-most-messages-alist nil
 bbdb-ignore-some-messages-alist nil
 bbdb-info-file nil
 bbdb-initialize-hook nil
 bbdb-list-hook '(bbdb-fontify-buffer)
 bbdb-load-hook nil
 bbdb-message-caching-enabled t
 bbdb-message-marker-field 'mark-char
 bbdb-mode-hook nil
 bbdb-new-nets-always-primary nil
 bbdb-north-american-phone-numbers-p nil
 bbdb-notes-default-separator ", "
 bbdb-notes-sort-order '((notes . 0) (www . 1) (ftp . 2) (gopher . 3) (telnet . 4) 
(mail-alias . 5) (mail-folder . 6)
                         (lpr . 7) (creation-date . 1000) (timestamp . 1001))
 bbdb-notice-auto-save-file nil
 bbdb-notice-hook '(bbdb-auto-notes-hook)
 bbdb-offer-save t
 bbdb-pop-up-elided-display '(creation-date timestamp pilot-id)
 bbdb-pop-up-elided-display-fields nil
 bbdb-pop-up-elided-display-name-end 48
 bbdb-pop-up-target-lines 5
 bbdb-quiet-about-name-mismatches nil
 bbdb-readonly-p nil
 bbdb-refile-notes-default-merge-function 'bbdb-refile-notes-default-merge-function
 bbdb-refile-notes-generate-alist '((creation-date . bbdb-refile-notes-string-least)
                                    (timestamp . bbdb-refile-notes-string-most))
 bbdb-save-db-timeout nil
 bbdb-send-mail-style nil
 bbdb-silent-running nil
 bbdb-use-alternate-names t
 bbdb-user-mail-names "\\bdaniel\\b"
 bbdb-write-file-hooks '(bbdb-write-file-hook-fn)
 bbdb/gnus-lines-and-from-length 18
 bbdb/gnus-split-crosspost-default nil
 bbdb/gnus-split-default-group "mail.misc"
 bbdb/gnus-split-myaddr-regexp 
"^daniel$\\|^daniel@\\([-a-z0-9]+\\.\\)*inanna.rimspace.net$"
 bbdb/gnus-split-nomatch-function nil
 bbdb/gnus-split-private-field 'gnus-private
 bbdb/gnus-split-public-field 'gnus-public
 bbdb/gnus-summary-mark-known-posters t
 bbdb/gnus-summary-show-bbdb-names t
 bbdb/mail-auto-create-p t
 bbdb/news-auto-create-p nil
 bbdb/prompt-for-create-p nil
 bbdb/vm-set-auto-folder-alist-field 'vm-folder
 features '(reporter hyper-apropos eldoc find-func debug pp rect tc overlay gnus-picon 
w3-forms w3-display w3-imap
            url-handlers w3-widget css font w3-mouse w3-vars w3-keymap w3-cus url 
mule-sysdp url-proxy url-privacy
            url-expand url-methods url-history url-cookie url-util url-parse url-auto 
url-vars annotations gnus-cite
            gnus-async gnus-score score-mode mail-extr gnus-ml gnus-msg disp-table 
late-misc nndraft nnmh gnus-cache
            nnfolder sort nnml nntp cookie1 gnus-art mm-uu binhex uudecode mm-view 
gnus-sum nnoo gnus-group gnus-undo
            nnmail mail-source rfc1843 gnus-start gnus-range gnus-spec gnus-int 
gnus-win setup-spellcheck dictionary link
            connection flyspell ispell setup-sgml setup-prog cc-mode cc-align cc-cmds 
cc-engine cc-styles cc-langs cc-vars
            cc-menus imenu cc-defs setup-prog-misc eval-expr setup-printing 
setup-packages setup-network w3-auto browse-url
            socks setup-mud setup-misc shell-font setup-gnuserv gnuserv setup-files 
tramp-vc tramp efs-dired dired-faces
            dired-xemacs dired shell format-spec timer efs-x19\.15 efs-fnh efs-ovwrt 
efs-netrc efs-defun efs jka-compr
            setup-editor permanent-buffers saveplace uniquify hippie-exp savehist 
ebuff-menu electric redo paren
            blink-paren setup-documentation setup-bbdb bbdb-autoloads bbdb-xemacs 
bbdb-gui bbdb-hooks bbdb-gnus gnus
            gnus-ems gnus-xmas wid-edit message messagexmas mml mml-sec mml-smime 
mml2015 smime dig mm-decode mm-bodies
            mm-encode mailcap mail-parse rfc2045 rfc2231 rfc2047 qp ietf-drums 
mail-abbrevs sendmail mailheader gnus-util
            time-date parse-time nnheader nnheaderxm mail-utils mm-util mail-prsvr 
bbdb-snarf bbdb-com bbdb timezone
            setup-autoinsert autoinsert setup-email dms-sig regexp-opt messkeyw 
mailcrypt rfc822 comint early-visual
            font-lock cus-face early-vc vc byte-optimize ring vc-hooks early-misc env 
early-lisp advice advice-preload
            efs-cu autoload bytecomp byte-compile zenirc-autoloads 
xslt-process-autoloads xemacs-devel-autoloads
            xemacs-base-autoloads view-process-autoloads vc-autoloads time-autoloads 
textools-autoloads
            text-modes-autoloads texinfo-autoloads supercite-autoloads 
speedbar-autoloads sounds-wav-autoloads
            slider-autoloads sh-script-autoloads sgml-autoloads semantic-autoloads 
reftex-autoloads psgml-autoloads
            ps-print-nomule-autoloads prog-modes-autoloads pcomplete-autoloads 
pcl-cvs-autoloads pc-autoloads
            os-utils-autoloads net-utils-autoloads misc-games-autoloads 
mailcrypt-autoloads mail-lib-autoloads
            jde-autoloads ispell-autoloads igrep-autoloads hm--html-menus-autoloads 
gnats-autoloads games-autoloads
            fsf-compat-autoloads frame-icon-autoloads forms-autoloads 
footnote-autoloads eudc-autoloads eterm-autoloads
            eshell-autoloads elib-autoloads eieio-autoloads efs-autoloads 
edit-utils-autoloads edebug-autoloads
            dired-autoloads debug-autoloads cookie-autoloads cc-mode-autoloads 
calendar-autoloads calc-autoloads
            c-support-autoloads auctex-autoloads apel-autoloads ada-autoloads 
mule-base-autoloads w3-autoloads
            url-autoloads lisp-autoloads loadhist auto-show fontl-hooks x-iso8859-1 
slovenian czech romanian ccl mule-help
            code-cmds gutter-items menubar-items x-menubar mode-motion mouse itimer 
auto-save lisp-mode easymenu iso8859-1
            page buff-menu lib-complete cus-file derived frame text-props obsolete 
cus-start custom widget cl-extra mini-cl
            cl cl-19 packages backquote very-early-lisp postgresqlv7 postgresql 
file-coding mule lucid-scrollbars
            cut-buffer lucid-menubars motif-dialogs x c-balloon-help tty-frames tty 
toolbar native-sound scrollbar
            unix-processes multicast network-streams subprocesses modules menubar 
berkeley-db md5 xemacs xim gutter tiff
            png gif jpeg xface xpm xbm lisp-float-type linux dialog devices 
window-system base64)
 )
-- 
The secret of happiness is this: Let your interests be as wide as
possible, and let your reactions to the things and persons that
interest you be as far as possible friendly rather than hostile. 
        -- Bertrand Russell


_______________________________________________
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to