🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87410

Re: .bbdb and .completions files corrupted

#87410
From: Erik Naggum
Date: Fri, 23 Sep 1994 03:04
54 lines
3043 bytes
[Chris Moore]

|   Here's a line from a .bbdb file that illustrates the problem:
|   
|   ["Luke" nil nil nil nil nil (#("l@c@ch.co.uk" 0 28 (face default))) nil nil]

I get (signal args-out-of-range (0 28)) from this, which makes sense since
the string is not 28 characters long.  I guess something went wrong when
writing this -- I doubt that "l@c@ch.co.ok" is the intended address.

hmmm.  here I find something else that must be a bug.  will have to
investigate further.

    #("l@c@ch.co.uk 0 11 (face default))
    => #("l@c@ch.co.uk" 0 1 nil 1 12 (face default))

which cannot be read back in again, so read and print are not in synch.

here's a function that you can use to remove the font information from such
files.  it expects a buffer with the offending forms in it.

(defun remove-face-information (&optional beg end)
  (interactive "r")
  (if (or (not beg) (not end))
      (setq beg (point-min)
	    end (point-max)))
  (save-restriction
    (goto-char beg)
    (narrow-to-region beg end)
    (while (re-search-forward "#(\"[^\"]*\" [0-9]" nil t)
      (goto-char (1+ (match-beginning 0)))
      (condition-case nil
	  (let ((face-info (read (current-buffer))))
	    (delete-region (match-beginning 0) (point))
	    (prin1 (car face-info) (current-buffer)))
	(error (goto-char (1+ (match-beginning 0))))))))

|   It seems that Emacs 19.25.95 could read such nonsence without error,
|   but that 19.27 can't.  I say this because one of the users who
|   complains hasn't changed his .bbdb file for some days, and I only
|   installed 19.27 yesterday - that's when the problem started.  This
|   could be wrong, but I don't think so.

the "nonsense" appears to be in what was written out to begin with.  the
range error detection is probably a fix, and it's a good one.  that faces
got into this in the first place is odd, but probably comes from careless
use of `buffer-substring'.  the problem here is only in part Emacs' fault.
since the .completions and .bbdb things are not distributed with Emacs, you
should take it up with them.  if they had been careful, there would not
have been any face information in the files to begin with.  (but I also
would not have discovered the discrepancy between read and print, so
something good came out of it, after all. :)

#<Erik>
Technical Details
Message-ID: <19940923.5394@naggum.no>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!naggum.no!erik
References: <9409220927.AA28078@sun25.src.bae.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,264cdbf1dc3d0205
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-09-22 21:24:05 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!naggum.no!erik
From: erik@naggum.no (Erik Naggum)
Newsgroups: gnu.emacs.bug
Subject: Re: .bbdb and .completions files corrupted
Date: 22 Sep 1994 23:04:03 -0400
Organization: Naggum Software; +47 2295 0313
Lines: 54
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <19940923.5394@naggum.no>
References: <9409220927.AA28078@sun25.src.bae.co.uk>