Subject: 23.0.90; sendmail-send-it not checking for call-process-region's return value properly

From: [email-masked]
Date: Sat, 21 Feb 2009 23:45:02 +0100

`sendmail-send-it' invokes `call-process-region' but doesn't check for
the case when the latter returns a string to indicate an error value.

This results in a backtrace like

  Debugger entered--Lisp error: (error "Format specifier doesn't match argument type")
    format("Sending...failed with exit value %d" "Broken pipe")
    apply(format ("Sending...failed with exit value %d" "Broken pipe"))
    error("Sending...failed with exit value %d" "Broken pipe")
    sendmail-send-it()
    mail-send()
    mail-send-and-exit(nil)
    call-interactively(mail-send-and-exit nil nil)

The following patch fixes that

--- lisp/mail/sendmail.el	2009-02-07 04:02:39.000000000 +0100
+++ lisp/mail/sendmail.el-hacked	2009-02-21 23:37:44.000000000 +0100
@@ -1168,8 +1168,13 @@
 			      )
 		      )
 		     (exit-value (apply 'call-process-region args)))
-		(or (null exit-value) (eq 0 exit-value)
-		    (error "Sending...failed with exit value %d" exit-value)))
+		(cond ((or (null exit-value) (eq 0 exit-value)))
+                      ((numberp exit-value)
+                       (error "Sending...failed with exit value %d" exit-value))
+                      ((stringp exit-value)
+                       (error "Sending...terminated by signal: %s" exit-value))
+                      (t 
+                       (error "SENDMAIL-SEND-IT -- fall through: %S" exit-value))))
 	    (or fcc-was-found
 		(error "No recipients")))
 	  (if mail-interactive

In GNU Emacs 23.0.90.4 (i686-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2009-02-21 on thaleron
Windowing system distributor `The X.Org Foundation', version 11.0.10400090
configured using `configure  '--prefix=/home/tcr/software/emacs-cvs' '--with-x-toolkit=gtk' '--without-gpm' '--with-x' '--without-xpm' '--enable-asserts' 'CFLAGS=-g''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  gnus-undo-mode: t
  diff-auto-refine-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
L S-SPC T R H O U G H . <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> M-l M-l <left> <left> <left> <left> <left> <backspace> 
<right> r <right> <right> <right> <right> <right> <right> 
<right> <left> <left> <backspace> : SPC % S <right> 
<right> <left> SPC e x i t - v a l u e <switch-frame> 
<down-mouse-5> <mouse-5> <double-down-mouse-5> <double-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <down-mouse-4> 
<mouse-4> <down-mouse-1> <mouse-1> <double-down-mouse-1> 
<double-mouse-1> u <help-echo> <switch-frame> <down-mouse-1> 
<mouse-movement> <mouse-1> C-M-k <up> ( o r C-) C-M-f 
SPC C-y <down> C-a C-k C-k C-x C-s C-M-x <switch-frame> 
<down-mouse-1> <mouse-movement> <mouse-1> C-x b C-g 
C-x C-b C-x o <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <return> q <up> <up> <up> <up> 
<down> C-x o M-x r e p o r t - e m <tab> <return> f 
o o <return> y <up> <up> <up> <up> <right> <right> 
<right> <right> C-k t c r @ f r e e b i t s . d e C-c 
C-c y e s <return> <switch-frame> C-x C-s <switch-frame> 
<down-mouse-1> <mouse-movement> <mouse-1> M-x g n u 
s <return> y <help-echo> <switch-frame> <down-mouse-1> 
<mouse-1> C-x C-f <help-echo> <switch-frame> <down-mouse-1> 
<mouse-1> M-x <switch-frame> <down-mouse-1> <mouse-movement> 
<mouse-1> M-x r e p o r t - e m a c s - b u g s <return> 
<M-backspace> b <tab> <return> F o o <return> y <up> 
<up> <up> <right> <right> <right> <up> <right> C-k 
t c r @ f r e e b i t s d e <backspace> <backspace> 
. d e C-c C-c y e s <return> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <help-echo> 
<down> <down> <down> <down> <down> <down> C-a C-SPC 
M-> C-w C-y C-x b <return> M-x r e p r <backspace> 
o r t <tab> <return>

Recent messages:
gnus-all-windows-visible-p: Invalid buffer type: if
Auto-saving...
ffap-read-file-or-url: Command attempted to use minibuffer while in minibuffer
Unsent message being composed; erase it? (y or n) 
Auto save file for draft message exists; consider M-x mail-recover
Sending...
smtpmail-open-stream: Autoloading failed to define function starttls-any-program-available
Auto-saving...done
Mark set [2 times]
Auto-saving...

-- 
Diese Nachricht wurde auf Viren und andere gefaerliche Inhalte untersucht
und ist - aktuelle Virenscanner vorausgesetzt - sauber.
Freebits E-Mail Virus Scanner