🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98978

minor "bugs" in rmail-convert-to-babyl-format in rmail.el

#98978
From: tuttle
Date: Thu, 13 Dec 1990 16:14
189 lines
6370 bytes
There seem to be two minor "bugs" in rmail-convert-to-babyl-format in rmail.el
(no version number given inside the elisp file, but M-x emacs-version returns
18.54.7)

1.  RMAIL files begin with the string "BABYL OPTIONS:", but the main loop in
rmail-convert-to-babyl-format searches for "Babyl Options:" with
case-fold-search set to nil, so the search fails:

  (defun rmail-convert-to-babyl-format ()
    (let ((count 0) start
          (case-fold-search nil))
      (goto-char (point-min))
      (save-restriction
        (while (not (eobp))
          (cond ((looking-at "Babyl Options:");Babyl header
                 (search-forward "\n\^_")
                 (delete-region (point-min) (point)))
                ;; Babyl format message
                  <code deleted>
                ;;*** MMDF format
                  <code deleted>
                ;;*** Mail format
                  <code deleted>
                (t (delete-char 1)))))
      count))

The result is that the babyl headers are deleted a character at a time.

2.  Given an RMAIL file `test' constructed by writing one message 
<output'd message> to test with `rmail-output-to-rmail-file' and a second 
message <FCC'd message> to test by placing `FCC:/udir/tuttle/mail/test' in 
the message header, rmail-convert-to-babyl-format places

	<output'd message>
	^_
	^L
	<FCC'd message>

rather than

	<output'd message>
	^_^L
	<FCC'd message>

at the boundary of the two messages.  The result is that that RMAIL does not
distinguish <output'd message> and <FCC'd message> as distinct messages.

To reproduce this behavior, given the RMAIL file test (delete every `X'
character in what follows)
-----------------------------test------------------------------------------
XBABYL OPTIONS:
XVersion: 5
XLabels:
XNote:   This is the header of an rmail file.
XNote:   If you are seeing it in rmail,
XNote:    it means the file has no messages in it.
XX
X1,,
XReceived: by crltrx.crl.dec.com; id AA02903; Tue, 11 Dec 90 13:21:31 -0500
XReceived: by easynet.crl.dec.com; id AA29943; Tue, 11 Dec 90 13:20:26 -0500
XDate: Tue, 11 Dec 90 13:21:27 -0500
XFrom: tuttle
XMessage-Id: <9012111821.AA04876@platte.crl.dec.com>
XTo: tuttle
XSubject: first message
X
X*** EOOH ***
XDate: Tue, 11 Dec 90 13:21:27 -0500
XFrom: tuttle
XTo: tuttle
XSubject: first message
X
XThis is the first message, written to RMAIL file test using 
Xrmail-output-to-rmail-file.
X
X
XFrom tuttle Tue Dec 11 13:23:00 1990
XTo: tuttle
XSubject: second message
X
XThis is the second message, written to RMAIL file test by placing
X	FCC: /udir/tuttle/mail/test
Xin the headers.
---------------------------------------------------------------------------
evaluating rmail-convert-to-babyl-format results in (again, delete every
`X' character in what follows)
-----------------------------new test-------------------------------------
X
X1,,
XReceived: by crltrx.crl.dec.com; id AA02903; Tue, 11 Dec 90 13:21:31 -0500
XReceived: by easynet.crl.dec.com; id AA29943; Tue, 11 Dec 90 13:20:26 -0500
XDate: Tue, 11 Dec 90 13:21:27 -0500
XFrom: tuttle
XMessage-Id: <9012111821.AA04876@platte.crl.dec.com>
XTo: tuttle
XSubject: first message
X
X*** EOOH ***
XDate: Tue, 11 Dec 90 13:21:27 -0500
XFrom: tuttle
XTo: tuttle
XSubject: first message
X
XThis is the first message, written to RMAIL file test using 
Xrmail-output-to-rmail-file.
X
X
X
X0, unseen,,
X*** EOOH ***
XDate: Tue, 11 Dec 90 13:23:00 EST
XFrom: tuttle
XTo: tuttle
XSubject: second message
X
XThis is the second message, written to RMAIL file test by placing
X	FCC: /udir/tuttle/mail/test
Xin the headers.
X
X
--------------------------------------------------------------------------

The offending code seems to be the line 
	       (skip-chars-forward " \t\n")
in the `Babyl format message' case of rmail-convert-to-babyl-format.
The code 

  (defun rmail-convert-to-babyl-format ()
    (let ((count 0) start
          (case-fold-search nil))
      (goto-char (point-min))
      (save-restriction
        (while (not (eobp))
          (cond ;; Babyl header

		;; <code deleted>

                ;; Babyl format message
                ((looking-at "\^L")
                 (or (search-forward "\n\^_" nil t)
                     (progn
                       (message "Invalid Babyl format in inbox!")
                       (sit-for 1)
                       (goto-char (point-max))))
                 (setq count (1+ count))
                 (skip-chars-forward " \t\n")
                 (narrow-to-region (point) (point-max)))
                ;;*** MMDF format

		;; <code deleted>

                ;;*** Mail format
                ((looking-at "^From ")
                 (setq start (point))
                 (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
  
                 ;; <code deleted>
  
                (t (delete-char 1)))))
      count))


causes the first message (in babyl format) to be skipped over and the point
placed just after the `^_' character in the two lines

 ^_
 From tuttle Tue Dec 11 13:23:00 1990

The expression

 (skip-chars-forward " \t\n")

causes the newline to be skipped and the point placed at the beginning
of the `From' line.  Now the case 

 (looking-at "^From ")

is satisfied and the lines

  ^L
  0, unseen,,
  *** EOOH ***

are inserted.  But ^_ and ^L are separated by a newline.

-------------------------------------------------------------------------
|Mark R. Tuttle					tuttle@crl.dec.com	|
|DEC Cambridge Research Lab			(617) 354-7395		|
-------------------------------------------------------------------------
Technical Details
Message-ID: <9012131614.AA06567@platte.crl.dec.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!CRL.DEC.COM!tuttle

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,732c8a25f682dbc9,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-12-13 08:14:22 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!CRL.DEC.COM!tuttle
From: tuttle@CRL.DEC.COM
Newsgroups: gnu.emacs.bug
Subject: minor "bugs" in rmail-convert-to-babyl-format in rmail.el
Message-ID: <9012131614.AA06567@platte.crl.dec.com>
Date: 13 Dec 90 16:14:22 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 189
Approved: bug-gnu-emacs@prep.ai.mit.edu
Posted: Thu Dec 13 17:14:22 1990