GNU bug report logs - #13330
24.2; rmail-set-header doesn't work for multi-line headers

Previous Next

Package: emacs;

Reported by: mdl <at> alum.mit.edu

Date: Tue, 1 Jan 2013 22:43:02 UTC

Severity: normal

Found in version 24.2

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13330 in the body.
You can then email your comments to 13330 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13330; Package emacs. (Tue, 01 Jan 2013 22:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to mdl <at> alum.mit.edu:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 01 Jan 2013 22:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mdl <at> alum.mit.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2; rmail-set-header doesn't work for multi-line headers
Date: Tue, 01 Jan 2013 14:40:52 -0800
This should be obvious from inspection (rmail.el:2166):

  (defun rmail-set-header-1 (name value)
    "Subroutine of `rmail-set-header'.
  Narrow to header, set header NAME to VALUE, replacing existing if present.
  VALUE nil means to remove NAME altogether."
    (if (search-forward "\n\n" nil t)
        (progn
  	(forward-char -1)
  	(narrow-to-region (point-min) (point))
  	(goto-char (point-min))
  	(if (re-search-forward (concat "^" (regexp-quote name) ":") nil 'move)
              (if value
                  (progn
                    (delete-region (point) (line-end-position))
                    (insert " " value))
                (delete-region (line-beginning-position)
                               (line-beginning-position 2)))
            (if value (insert name ": " value "\n"))))
      (rmail-error-bad-format)))
  
  (defun rmail-set-header (name &optional msgnum value)
    "Set message header NAME to VALUE in message number MSGNUM.
  If MSGNUM is nil, use the current message.  NAME and VALUE are strings.
  VALUE may also be nil, meaning to remove the header."
    (rmail-apply-in-message msgnum 'rmail-set-header-1 name value)
    (with-current-buffer rmail-buffer
      ;; Ensure header changes get saved.
      ;; (Note replacing a header with an identical copy modifies.)
      (set-buffer-modified-p t)
      ;; However: don't save in mbox format over a Babyl file
      ;; merely because of this.
      (rmail-dont-modify-format)))

but if not, evaluate (esc-:) "(rmail-set-header "subject" nil)" on a
Rmail message with a multiline subject like:

|X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED,
|	RP_MATCHES_RCVD autolearn=unavailable version=3.3.1
|From: Mark Lillibridge <mark.lillibridge <at> hp.com>
|To: <bug-gnu-emacs <at> gnu.org>
|Subject: this is a long subject
|  with several lines
|  indeed
|Date: Sat, 22 Oct 2011 12:05:57 -0700
|Reply-To: <mark.lillibridge <at> hp.com>
|Content-type: text/plain; charset=us-ascii
|
|
|empty body

The result (after hitting t twice to re-decode) is:

|X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED,
|	RP_MATCHES_RCVD autolearn=unavailable version=3.3.1
|From: Mark Lillibridge <mark.lillibridge <at> hp.com>
|To: <bug-gnu-emacs <at> gnu.org>
|  with several lines
|  indeed
|Date: Sat, 22 Oct 2011 12:05:57 -0700
|Reply-To: <mark.lillibridge <at> hp.com>
|Content-type: text/plain; charset=us-ascii
|
|
|empty body

Notice that only the first line of the Subject has been deleted.  

    Should there be a warning that this function does not RFC2047 encode
value so the caller is responsible for doing any such encoding if
needed?

- Mark




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 03 Jan 2013 19:44:02 GMT) Full text and rfc822 format available.

Notification sent to mdl <at> alum.mit.edu:
bug acknowledged by developer. (Thu, 03 Jan 2013 19:44:02 GMT) Full text and rfc822 format available.

Message #10 received at 13330-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 13330-done <at> debbugs.gnu.org
Subject: Re: bug#13330: 24.2;
	rmail-set-header doesn't work for multi-line headers
Date: Thu, 03 Jan 2013 14:42:53 -0500
Version: 24.4

Fixed in trunk.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 01 Feb 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.