all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21602@debbugs.gnu.org
Subject: bug#21602: 25.0.50; coding system seg fault
Date: Fri, 02 Oct 2015 21:37:48 -0400	[thread overview]
Message-ID: <E1ZiBlk-0000xd-HZ@fencepost.gnu.org> (raw)
In-Reply-To: <83vbap7nv6.fsf@gnu.org> (message from Eli Zaretskii on Fri, 02 Oct 2015 10:04:13 +0300)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > When I try to send the following buffer with Mail mode,
  > > I get a seg fault within write_region as it tries to handle
  > > 'us-ascii' as the mime charset.

  > I tried to reproduce this, but it didn't fail for me.  There are too
  > many parameters involved in sending email, starting with your
  > mail-client package, so it's small wonder I couldn't reproduce this
  > easily.

I use Mail mode.  But the problem depends on my local mail setup.

I can reproduce the failure in emacs -Q with the code below.  The code
in my-send-1 is responsible for passing specifying the coding system,
but even if that value is wrong, write-region should not crash.


(setq mail-user-agent 'sendmail-user-agent)

  (setq send-mail-function 'my-send-it)

(defvar private-regexp
  "ffofoofofofofofo@")

(defun my-send-it ()
  (save-excursion
    (let (buffer-undo-list
	  (case-fold-search t)
	  list-to-undo)
      (if (save-excursion
	    (goto-char (point-min))
	    (re-search-forward "^to:")
	    (let ((end (save-excursion (forward-line 1) (point))))
	      (re-search-forward private-regexp end t)))
	  (save-excursion
	    (goto-char (point-min))
	    (re-search-forward "^reply-to:")
	    (let ((end (save-excursion (forward-line 1) (point))))
	      (replace-string "rms@" "rms-private@" nil (point) end)))
	(save-excursion
	  (goto-char (point-min))
	  (unless (re-search-forward "^bcc: rms-outgoing@gnu.org\n" nil t)
	    (re-search-forward "^reply-to:")
	    (beginning-of-line)
	    (insert "bcc: rms-outgoing@gnu.org\n"))
	  (setq list-to-undo buffer-undo-list)))
      (if (save-excursion
	    (goto-char (point-min))
	    (re-search-forward "^reply-to:")
	    (let ((end (save-excursion (forward-line 1) (point))))
	      (re-search-forward "rms-private" end t)))
	  (my-send-1 "out-")
	(my-send-1 "out-"))

      (while list-to-undo
	(let ((undo-in-progress t))
	  (setq list-to-undo (primitive-undo 1 list-to-undo)))))))

(defun my-send-1 (base)
  (let* ((default-directory (expand-file-name "~/outgoing/"))
	 (files (file-name-all-completions base default-directory))
	 (versions (mapcar (function (lambda (name)
				       (string-to-int (substring name (length base)))))
			   files))
	 (coding-system-for-write
	  (save-excursion
	    (goto-char (point-min))
	    (if (re-search-forward "^Content-Type:.*; *charset=\\([^;\n]+\\)"
				   nil t)
		(intern (downcase (match-string 1)))
	      coding-system-for-write))))
    (write-region (point-min) (point-max)
		  (format "%s%d" base
			  (if versions
			      (1+ (apply 'max versions))
			    1)))))


-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.






  reply	other threads:[~2015-10-03  1:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02  2:32 bug#21602: 25.0.50; coding system seg fault Richard Stallman
2015-10-02  7:04 ` Eli Zaretskii
2015-10-03  1:37   ` Richard Stallman [this message]
2015-10-03 10:48     ` Eli Zaretskii
2015-10-03 11:30       ` Andreas Schwab
2015-10-03 11:51         ` Eli Zaretskii
2015-10-03 12:14           ` Andreas Schwab
2015-10-03 12:42             ` Eli Zaretskii
2015-10-03 12:50               ` Andreas Schwab
2015-10-03 13:15                 ` Eli Zaretskii
2015-10-03 14:19                   ` Eli Zaretskii
2015-10-03 15:00                     ` Andreas Schwab
2015-10-03 15:26                       ` Eli Zaretskii
2015-10-03 16:09                         ` Andreas Schwab
2015-10-03 16:11                           ` Eli Zaretskii
2015-10-03 17:22                     ` Zack Piper
2015-10-03 18:16                       ` Andreas Schwab
2015-10-03 12:07       ` Andreas Schwab
2015-10-03 12:15         ` Eli Zaretskii
2015-10-03 12:25           ` Andreas Schwab
2015-10-03 12:36             ` Eli Zaretskii
2015-10-03 12:48               ` Andreas Schwab
2015-10-03 13:14                 ` Eli Zaretskii
2015-10-03  1:37   ` Richard Stallman
2015-10-03 10:49     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1ZiBlk-0000xd-HZ@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=21602@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.