I am using BBDB with VM, and have found occasional failures with the
error  (wrong-type-argument stringp nil) inside BBDB-UPDATE-RECORDS.

AFAICT this problem occurs when I get the occasional mailing list
email that tries to be nicely privacy-protecting.  The headers for
such an email look like this:

... and this causes a call to bbdb-update-records that looks like
this:

bbdb-update-records(((authors "From" (nil "[EMAIL PROTECTED]")) (recipients 
"To" (nil nil))) nil nil)

I *believe* a proper solution is to modify bbdb-update-records to
check that there's a net address before trying to invoke regexp-quote
on it.  Here's a proposed patch (look for the WHEN test with a comment
by rpg...):

(defun bbdb-update-records (addrs auto-create-p offer-to-create)
    "Returns the records corresponding to the list of addresses ADDRS,
creating or modifying them as necessary.  A record will be created if
AUOT-CREATE-P is non-nil or if OFFER-TO-CREATE is true and the user
confirms the creation.

The variable `bbdb/gnus-update-records-mode' controls what actions
are performed and it might override `bbdb-update-records-mode'.

When hitting C-g once you will not be asked any more for new people listed
in this message, but it will search only for existing records.  When hitting
C-g again it will stop scanning."
    (setq auto-create-p (bbdb-invoke-hook-for-value auto-create-p))

    (let ((bbdb-records (bbdb-records))
          (processed-addresses 0)
          (bbdb-offer-to-create (or offer-to-create (eq 'prompt auto-create-p)))
          (bbdb-update-records-mode
           (if offer-to-create 'annotating
               (if (listp bbdb-update-records-mode)
                   (eval bbdb-update-records-mode)
                   bbdb-update-records-mode)))
          (addrslen (length addrs))
          (bbdb-update-address-class nil)
          (bbdb-update-address-header nil)
          records hits)

      (while addrs

        (setq bbdb-address (car addrs)
              bbdb-update-address-class (car bbdb-address)
              bbdb-update-address-header (cadr bbdb-address)
              bbdb-address (caddr bbdb-address))

        (condition-case nil
             (progn
               (setq hits
                     (cond ((eq bbdb-update-records-mode 'annotating)
                            (list;; search might return a list
                             (bbdb-annotate-message-sender
                              bbdb-address t
                              (or offer-to-create;; force create
                                  auto-create-p)
                              'bbdb-prompt-for-create)))
                           ((eq bbdb-update-records-mode 'searching)
                            ;; search for records having this net
                            ;; first make sure there's a net there...
                            ;; [2004/12/16:rpg]
                            (when (cadr bbdb-address)
                              (let ((net (concat "^"
                                                 (regexp-quote
                                                  (cadr bbdb-address))
                                                 "$"))
                                    ;; there is no case for nets
                                    (bbdb-case-fold-search t))
                                (bbdb-search bbdb-records nil nil net)))))
                     processed-addresses (+ processed-addresses 1))

               (when (and (not bbdb-silent-running)
                          (not bbdb-gag-messages)
                          (not (eq bbdb-offer-to-create 'quit))
                          (= 0 (% processed-addresses 5)))
                 (let ((mess (format "Hit C-g to stop BBDB from %s.  %d of %d 
addresses processed."
                                     bbdb-update-records-mode 
processed-addresses addrslen)))
                   (if (featurep 'xemacs)
                       (bbdb-display-message 'progress mess)
                       (message mess)))
                 (sit-for 0)))

           ;; o.k. there was a quit signal so how should we proceed now?
           (quit (cond ((eq bbdb-update-records-mode 'annotating)
                        (setq bbdb-update-records-mode 'searching))
                       ((eq bbdb-update-records-mode 'searching)
                        nil)
                       ((eq bbdb-update-records-mode 'next)
                        (setq bbdb-update-records-mode 'annotating))
                       (t
                        (setq bbdb-update-records-mode 'quit)))
                 nil))

        (while hits
          ;; people should be listed only once so we use add-to-list
          (if (car hits) (add-to-list 'records (car hits)))
          (setq hits (cdr hits)))

        (setq addrs (cdr addrs)))

      ;; add-to-list adds at the front so we have to reverse the list in order
      ;; to reflect the order of the records as they appear in the headers.
      (setq records (nreverse records))

      (if (not (or bbdb-silent-running
                   bbdb-gag-messages
                   (not records)
                   (> (length records) 1)))
          ;; maybe this should just be omitted, really.
          (message "Updating of BBDB records finished"))
      records))

This seems to fix the bug, AFAICT.

[I know I should probably do the bbdb-submit-bug-report thing, but
honestly, I'm not thrilled to use a function that could be sending
arbitrary chunks of private information around to be shared with the
full internet in perpetuity...]


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to