Subject: 24.3; message-sendmail-extra-arguments not applied

From: Myles English <[email-masked]>
Date: Sat, 02 Aug 2014 15:13:23 +0100

Sending mail via msmtp worked.  Then I moved the msmptrc config file
from its default ~/.msmtprc and modified
message-sendmail-extra-arguments to account for the new location:

(setq message-sendmail-extra-arguments '("-C"
      "/home/myles/.config/msmtp/msmtprc"))

But got the error "Sending...failed with exit value 78".

The patch below prevents that error, allows the extra arguments to be
applied, and thus the config file to be found.

I believe this bug is (at least) nearly five years old, e.g.:
http://lists.gnu.org/archive/html/info-gnus-english/2009-09/msg00048.html

Thanks,
Myles

--- message.el
+++ message.el
@@ -4723,9 +4723,7 @@
 		(erase-buffer))))
 	  (let* ((default-directory "/")
 		 (coding-system-for-write message-send-coding-system)
-		 (cpr (apply
-		       'call-process-region
-		       (append
+		 (args (append
 			(list (point-min) (point-max) sendmail-program
 			      nil errbuf nil "-oi")
 			message-sendmail-extra-arguments
@@ -4745,7 +4743,8 @@
 			;; For a resend, include the specific addresses.
 			(if resend-to-addresses
 			    (list resend-to-addresses)
-			  '("-t"))))))
+			  '("-t"))))
+		 (cpr (apply 'call-process-region args)))
 	    (unless (or (null cpr) (and (numberp cpr) (zerop cpr)))
               (if errbuf (pop-to-buffer errbuf))
 	      (error "Sending...failed with exit value %d" cpr)))

In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
 of 2014-06-11 on var-lib-archbuild-staging-x86_64-jgc
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:	Arch Linux

Configured using:
 `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 --param=ssp-buffer-size=4'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_CTYPE: en_GB.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8
  default enable-multibyte-characters: t

Major mode: mu4e:compose

Minor modes in effect:
  flyspell-mode: t
  show-paren-mode: t
  mml-mode: t
  workgroups-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: 1
  line-number-mode: t
  auto-fill-function: message-do-auto-fill
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
scrubbed

Load-path shadows:
/home/myles/.emacs.d/plugins/python-mode/python-mode hides /usr/share/emacs/site-lisp/python-mode
~/.emacs.d/plugins/org-mode/lisp/org-bibtex hides /usr/share/emacs/24.3/lisp/org/org-bibtex
~/.emacs.d/plugins/org-mode/lisp/org-id hides /usr/share/emacs/24.3/lisp/org/org-id
~/.emacs.d/plugins/org-mode/lisp/org-gnus hides /usr/share/emacs/24.3/lisp/org/org-gnus
~/.emacs.d/plugins/org-mode/lisp/org-clock hides /usr/share/emacs/24.3/lisp/org/org-clock
~/.emacs.d/plugins/org-mode/lisp/ob-plantuml hides /usr/share/emacs/24.3/lisp/org/ob-plantuml
~/.emacs.d/plugins/org-mode/lisp/org-attach hides /usr/share/emacs/24.3/lisp/org/org-attach
~/.emacs.d/plugins/org-mode/lisp/org-table hides /usr/share/emacs/24.3/lisp/org/org-table
~/.emacs.d/plugins/org-mode/lisp/ob-ditaa hides /usr/share/emacs/24.3/lisp/org/ob-ditaa
~/.emacs.d/plugins/org-mode/lisp/org-pcomplete hides /usr/share/emacs/24.3/lisp/org/org-pcomplete
~/.emacs.d/plugins/org-mode/lisp/ob-table hides /usr/share/emacs/24.3/lisp/org/ob-table
~/.emacs.d/plugins/org-mode/lisp/ob-ref hides /usr/share/emacs/24.3/lisp/org/ob-ref
~/.emacs.d/plugins/org-mode/lisp/ob-exp hides /usr/share/emacs/24.3/lisp/org/ob-exp
~/.emacs.d/plugins/org-mode/lisp/ob-tangle hides /usr/share/emacs/24.3/lisp/org/ob-tangle
~/.emacs.d/plugins/org-mode/lisp/ob-asymptote hides /usr/share/emacs/24.3/lisp/org/ob-asymptote
~/.emacs.d/plugins/org-mode/lisp/org hides /usr/share/emacs/24.3/lisp/org/org
~/.emacs.d/plugins/org-mode/lisp/org-feed hides /usr/share/emacs/24.3/lisp/org/org-feed
~/.emacs.d/plugins/org-mode/lisp/ob-js hides /usr/share/emacs/24.3/lisp/org/ob-js
~/.emacs.d/plugins/org-mode/lisp/org-list hides /usr/share/emacs/24.3/lisp/org/org-list
~/.emacs.d/plugins/org-mode/lisp/ob-matlab hides /usr/share/emacs/24.3/lisp/org/ob-matlab
~/.emacs.d/plugins/org-mode/lisp/org-src hides /usr/share/emacs/24.3/lisp/org/org-src
~/.emacs.d/plugins/org-mode/lisp/ob-octave hides /usr/share/emacs/24.3/lisp/org/ob-octave
~/.emacs.d/plugins/org-mode/lisp/org-ctags hides /usr/share/emacs/24.3/lisp/org/org-ctags
~/.emacs.d/plugins/org-mode/lisp/ob-comint hides /usr/share/emacs/24.3/lisp/org/ob-comint
~/.emacs.d/plugins/org-mode/lisp/org-compat hides /usr/share/emacs/24.3/lisp/org/org-compat
~/.emacs.d/plugins/org-mode/lisp/ob-sass hides /usr/share/emacs/24.3/lisp/org/ob-sass
~/.emacs.d/plugins/org-mode/lisp/org-habit hides /usr/share/emacs/24.3/lisp/org/org-habit
~/.emacs.d/plugins/org-mode/lisp/org-docview hides /usr/share/emacs/24.3/lisp/org/org-docview
~/.emacs.d/plugins/org-mode/lisp/org-entities hides /usr/share/emacs/24.3/lisp/org/org-entities
~/.emacs.d/plugins/org-mode/lisp/org-protocol hides /usr/share/emacs/24.3/lisp/org/org-protocol
~/.emacs.d/plugins/org-mode/lisp/ob-python hides /usr/share/emacs/24.3/lisp/org/ob-python
~/.emacs.d/plugins/org-mode/lisp/ob-maxima hides /usr/share/emacs/24.3/lisp/org/ob-maxima
~/.emacs.d/plugins/org-mode/lisp/ob-eval hides /usr/share/emacs/24.3/lisp/org/ob-eval
~/.emacs.d/plugins/org-mode/lisp/ob-fortran hides /usr/share/emacs/24.3/lisp/org/ob-fortran
~/.emacs.d/plugins/org-mode/lisp/ob-mscgen hides /usr/share/emacs/24.3/lisp/org/ob-mscgen
~/.emacs.d/plugins/org-mode/lisp/org-element hides /usr/share/emacs/24.3/lisp/org/org-element
~/.emacs.d/plugins/org-mode/lisp/org-plot hides /usr/share/emacs/24.3/lisp/org/org-plot
~/.emacs.d/plugins/org-mode/lisp/org-mhe hides /usr/share/emacs/24.3/lisp/org/org-mhe
~/.emacs.d/plugins/org-mode/lisp/ob-screen hides /usr/share/emacs/24.3/lisp/org/ob-screen
~/.emacs.d/plugins/org-mode/lisp/org-crypt hides /usr/share/emacs/24.3/lisp/org/org-crypt
~/.emacs.d/plugins/org-mode/lisp/org-eshell hides /usr/share/emacs/24.3/lisp/org/org-eshell
~/.emacs.d/plugins/org-mode/lisp/ob-calc hides /usr/share/emacs/24.3/lisp/org/ob-calc
~/.emacs.d/plugins/org-mode/lisp/ob-awk hides /usr/share/emacs/24.3/lisp/org/ob-awk
~/.emacs.d/plugins/org-mode/lisp/ob-io hides /usr/share/emacs/24.3/lisp/org/ob-io
~/.emacs.d/plugins/org-mode/lisp/ob-org hides /usr/share/emacs/24.3/lisp/org/ob-org
~/.emacs.d/plugins/org-mode/lisp/ob-lilypond hides /usr/share/emacs/24.3/lisp/org/ob-lilypond
~/.emacs.d/plugins/org-mode/lisp/org-faces hides /usr/share/emacs/24.3/lisp/org/org-faces
~/.emacs.d/plugins/org-mode/lisp/ob-scheme hides /usr/share/emacs/24.3/lisp/org/ob-scheme
~/.emacs.d/plugins/org-mode/lisp/ob-lob hides /usr/share/emacs/24.3/lisp/org/ob-lob
~/.emacs.d/plugins/org-mode/lisp/ob-gnuplot hides /usr/share/emacs/24.3/lisp/org/ob-gnuplot
~/.emacs.d/plugins/org-mode/lisp/ob-ledger hides /usr/share/emacs/24.3/lisp/org/ob-ledger
~/.emacs.d/plugins/org-mode/lisp/org-loaddefs hides /usr/share/emacs/24.3/lisp/org/org-loaddefs
~/.emacs.d/plugins/org-mode/lisp/org-agenda hides /usr/share/emacs/24.3/lisp/org/org-agenda
~/.emacs.d/plugins/org-mode/lisp/org-mouse hides /usr/share/emacs/24.3/lisp/org/org-mouse
~/.emacs.d/plugins/org-mode/lisp/org-indent hides /usr/share/emacs/24.3/lisp/org/org-indent
~/.emacs.d/plugins/org-mode/lisp/org-archive hides /usr/share/emacs/24.3/lisp/org/org-archive
~/.emacs.d/plugins/org-mode/lisp/org-install hides /usr/share/emacs/24.3/lisp/org/org-install
~/.emacs.d/plugins/org-mode/lisp/ob-sql hides /usr/share/emacs/24.3/lisp/org/ob-sql
~/.emacs.d/plugins/org-mode/lisp/org-rmail hides /usr/share/emacs/24.3/lisp/org/org-rmail
~/.emacs.d/plugins/org-mode/lisp/ob-java hides /usr/share/emacs/24.3/lisp/org/ob-java
~/.emacs.d/plugins/org-mode/lisp/ob hides /usr/share/emacs/24.3/lisp/org/ob
~/.emacs.d/plugins/org-mode/lisp/org-macs hides /usr/share/emacs/24.3/lisp/org/org-macs
~/.emacs.d/plugins/org-mode/lisp/org-info hides /usr/share/emacs/24.3/lisp/org/org-info
~/.emacs.d/plugins/org-mode/lisp/ob-C hides /usr/share/emacs/24.3/lisp/org/ob-C
~/.emacs.d/plugins/org-mode/lisp/ob-perl hides /usr/share/emacs/24.3/lisp/org/ob-perl
~/.emacs.d/plugins/org-mode/lisp/ob-dot hides /usr/share/emacs/24.3/lisp/org/ob-dot
~/.emacs.d/plugins/org-mode/lisp/org-irc hides /usr/share/emacs/24.3/lisp/org/org-irc
~/.emacs.d/plugins/org-mode/lisp/org-w3m hides /usr/share/emacs/24.3/lisp/org/org-w3m
~/.emacs.d/plugins/org-mode/lisp/org-colview hides /usr/share/emacs/24.3/lisp/org/org-colview
~/.emacs.d/plugins/org-mode/lisp/ob-keys hides /usr/share/emacs/24.3/lisp/org/ob-keys
~/.emacs.d/plugins/org-mode/lisp/ob-scala hides /usr/share/emacs/24.3/lisp/org/ob-scala
~/.emacs.d/plugins/org-mode/lisp/org-inlinetask hides /usr/share/emacs/24.3/lisp/org/org-inlinetask
~/.emacs.d/plugins/org-mode/lisp/ob-ruby hides /usr/share/emacs/24.3/lisp/org/ob-ruby
~/.emacs.d/plugins/org-mode/lisp/org-bbdb hides /usr/share/emacs/24.3/lisp/org/org-bbdb
~/.emacs.d/plugins/org-mode/lisp/ob-sqlite hides /usr/share/emacs/24.3/lisp/org/ob-sqlite
~/.emacs.d/plugins/org-mode/lisp/ob-css hides /usr/share/emacs/24.3/lisp/org/ob-css
~/.emacs.d/plugins/org-mode/lisp/ob-lisp hides /usr/share/emacs/24.3/lisp/org/ob-lisp
~/.emacs.d/plugins/org-mode/lisp/ob-clojure hides /usr/share/emacs/24.3/lisp/org/ob-clojure
~/.emacs.d/plugins/org-mode/lisp/ob-ocaml hides /usr/share/emacs/24.3/lisp/org/ob-ocaml
~/.emacs.d/plugins/org-mode/lisp/ob-picolisp hides /usr/share/emacs/24.3/lisp/org/ob-picolisp
~/.emacs.d/plugins/org-mode/lisp/ob-shen hides /usr/share/emacs/24.3/lisp/org/ob-shen
~/.emacs.d/plugins/org-mode/lisp/org-mobile hides /usr/share/emacs/24.3/lisp/org/org-mobile
~/.emacs.d/plugins/org-mode/lisp/ob-R hides /usr/share/emacs/24.3/lisp/org/ob-R
~/.emacs.d/plugins/org-mode/lisp/org-datetree hides /usr/share/emacs/24.3/lisp/org/org-datetree
~/.emacs.d/plugins/org-mode/lisp/org-capture hides /usr/share/emacs/24.3/lisp/org/org-capture
~/.emacs.d/plugins/org-mode/lisp/ob-latex hides /usr/share/emacs/24.3/lisp/org/ob-latex
~/.emacs.d/plugins/org-mode/lisp/org-timer hides /usr/share/emacs/24.3/lisp/org/org-timer
~/.emacs.d/plugins/org-mode/lisp/ob-haskell hides /usr/share/emacs/24.3/lisp/org/ob-haskell
~/.emacs.d/plugins/org-mode/lisp/org-version hides /usr/share/emacs/24.3/lisp/org/org-version
~/.emacs.d/plugins/org-mode/lisp/ob-emacs-lisp hides /usr/share/emacs/24.3/lisp/org/ob-emacs-lisp
~/.emacs.d/plugins/org-mode/lisp/org-footnote hides /usr/share/emacs/24.3/lisp/org/org-footnote
~/.emacs.d/plugins/org-mode/lisp/org-checklist hides ~/.emacs.d/plugins/org-mode/contrib/lisp/org-checklist
/usr/share/emacs/24.3/lisp/org/org-vm hides ~/.emacs.d/plugins/org-mode/contrib/lisp/org-vm
/usr/share/emacs/24.3/lisp/org/org-mew hides ~/.emacs.d/plugins/org-mode/contrib/lisp/org-mew
/usr/share/emacs/24.3/lisp/org/org-wl hides ~/.emacs.d/plugins/org-mode/contrib/lisp/org-wl

Features:
(shadow emacsbug image-file org-capture goto-addr view windmove misearch
multi-isearch help-mode debug mail-extr sort flyspell ispell mule-util
paren auto-complete-autoloads popup-autoloads yasnippet-autoloads
inf-haskell haskell-cabal haskell-utils haskell-decl-scan haskell-mode
haskell-string haskell-sort-imports haskell-align-imports dabbrev
org-mu4e re-builder mu4e mu4e-speedbar speedbar sb-image ezimage dframe
mu4e-main mu4e-view epa epg epg-config mu4e-headers mu4e-compose
mu4e-draft mu4e-actions rfc2368 smtpmail sendmail mu4e-mark mu4e-message
html2text mu4e-proc mu4e-utils mu4e-lists mu4e-about mu4e-vars message
idna rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader
hl-line mu4e-meta column-marker bbdb-loaddefs date-calc workgroups tramp
tramp-compat auth-source eieio byte-opt bytecomp byte-compile cconv
gnus-util mm-util mail-prsvr password-cache tramp-loaddefs python-mode
skeleton imenu flymake rx cc-cmds cc-engine ido ess-toolbar ess-mouse
mouseme thingatpt browse-url ess-menu ess-swv ess-noweb
ess-noweb-font-lock-mode ess-bugs-l essd-els ess-sas-d ess-sas-l
ess-sas-a ess-arc-d ess-vst-d ess-xls-d ess-lsp-l ess-sta-d ess-sta-l
cc-vars cc-defs make-regexp ess-sp6-d ess-sp5-d ess-sp3-d ess-julia
ess-r-d compile ess-tracebug ess-roxy hideshow ess-help ess-developer
ess-r-args eldoc ess-s-l ess ess-inf ess-mode ess-noweb-mode ess-utils
ess-custom executable ess-compat ess-site yaml-mode derived org-odt
org-lparse org-w3m org-wl org-vm org-special-blocks org-rmail org-mhe
org-mew org-irc org-inlinetask org-habit org-jsinfo org-infojs org-info
org-docview doc-view jka-compr image-mode dired org-bibtex bibtex
org-attach vc-git org-drill org-learn org-id hi-lock org-refer-by-number
org-table rebox2 org-checklist ox-groff cl-macs gv cl org-scrlttr2
org-isodoc org-letter-utils org-bbdb org-latex-generic org-latex
org-export-latex org-beamer footnote ox-koma-letter org-html org-exp
org-exp-blocks org-agenda ob-plantuml ob-ledger ob-latex ob-sh shell
ob-python ob-sql ob-org ob-R org-clock ox-latex ox-icalendar ox-html
ox-ascii ox-publish ox org-element avl-tree org org-macro org-footnote
org-pcomplete pcomplete org-list org-faces org-entities noutline outline
easy-mmode org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-src ob-keys ob-comint comint ansi-color ring ob-core ob-eval
org-compat org-macs org-loaddefs format-spec find-func cal-menu easymenu
calendar cal-loaddefs edmacro kmacro uniquify advice help-fns cl-lib
advice-preload zenburn-theme ukholidays package time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)