Bug 213813

Summary: emacs's sendmail mangles all the headers
Product: [Fedora] Fedora Reporter: Wolfgang Rupprecht <wolfgang.rupprecht>
Component: emacsAssignee: Chip Coldwell <coldwell>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: agw, eli, herb, jeff
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-06 16:36:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wolfgang Rupprecht 2006-11-03 03:26:14 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.7) Gecko/20061027 Fedora/1.5.0.7-8.fc6 Firefox/1.5.0.7

Description of problem:
try sending mail to yourself from emacs with "m-x mail".  Notice
what looks like two clumps of headers, one inside the message one as the message header.  The problem is that emacs incorrectly tries to use an emacs program called "fakemail"  to send the mail.  It appears that the emacs rpm's were built on a more or less empty machine where sendmail didn't exist.  Some logic in 
lisp/paths.el looks for the various places sendmail typically hides and then 
as a final fallback supplies an emacs program fakemail qthat probably hasn't worked in 10 years.

Version-Release number of selected component (if applicable):
emacs-21.4-17

How reproducible:
Always


Steps to Reproduce:
1.start "emacs -q"
2. type m-x mail
3. compose and send mail to yourself
4. read the mailbox file using more.

Actual Results:
one gets a double set of headers, with the topmost one lacking a subject line
and lacking all the user and programatically added headers.  Notice that all the 
missing headers are included in the message body.

Expected Results:
A message with one block of headers and all the user added headers (like subject)

Additional info:
The immediate problem is that the sendmail-program is "fakemail" instead of 
"/usr/sbin/sendmail".  The only way I can see this happening is if emacs was built on a system that didn't have sendmail on it, so when the file-exists-p test was initially done, it returned nil.  This sendmail-program value was then 
dumped in the emacs load-up and dump stage.  So even if the user later installs the sendmail rpm emacs never tests to see if it exists.

One simple fix would be to hardwire the sendmail path in so even if sendmail doesn't exist at the time emacs is compiled and dumped, the correct path is still stored.  Note there are a few similar defconst's in the same file that might also have problems.  They haven't bitten me so I haven't looked too hard.

diff -u /usr/share/emacs/21.4/lisp/paths.el.\~1\~ /usr/share/emacs/21.4/lisp/paths.el
--- /usr/share/emacs/21.4/lisp/paths.el.~1~	2001-07-15 09:15:34.000000000 -0700
+++ /usr/share/emacs/21.4/lisp/paths.el	2006-11-02 19:19:09.000000000 -0800
@@ -161,12 +161,7 @@
   "Name of directory used by system mailer for delivering new mail.
 Its name should end with a slash.")
 
-(defconst sendmail-program
-  (cond
-    ((file-exists-p "/usr/sbin/sendmail") "/usr/sbin/sendmail")
-    ((file-exists-p "/usr/lib/sendmail") "/usr/lib/sendmail")
-    ((file-exists-p "/usr/ucblib/sendmail") "/usr/ucblib/sendmail")
-    (t "fakemail"))			;In ../etc, to interface to /bin/mail.
+(defconst sendmail-program "/usr/sbin/sendmail"
   "Program used to send messages.")
 
 (defconst remote-shell-program

Diff finished at Thu Nov  2 19:19:30

Comment 1 Chip Coldwell 2006-11-03 15:58:50 UTC
The "minimal buildroots" Fedora policy comes back to bite us in the ass.  A
better solution than the proposed patch is just to add a "BuildRequires:
sendmail" to the  spec file -- that will cause the brew build system to put
sendmail into the buildroot.

I put some test rpms up at

http://people.redhat.com/coldwell/bugs/emacs/213813/

please download and verify that the bug is fixed.

Chip


Comment 2 Wolfgang Rupprecht 2006-11-03 16:36:09 UTC
It looks good.  The sendmail-program variable is now correctly set and the sent
mail looks normal too.

Comment 3 Chip Coldwell 2006-11-06 16:36:34 UTC
FC-5: 21.4-16.3
FC-6: 21.4-17.2
RAWHIDE: 21.4-19


Comment 4 Chip Coldwell 2006-11-29 15:38:11 UTC
*** Bug 217252 has been marked as a duplicate of this bug. ***

Comment 5 Chip Coldwell 2006-12-13 16:22:55 UTC
*** Bug 219419 has been marked as a duplicate of this bug. ***

Comment 6 Jeff Norden 2007-01-10 15:29:09 UTC
I got bit by this too, and wasted an hour or so playing with sendmail.cf before
realizing that the problem was in emacs.

A simple workaround is to add (load-library "paths") to .emacs, which will
re-load the paths.el file and re-set the value of the sendmail-program variable.

It seems to me that it would be worth adding the 21.4-17.2 version to the fc6
updates - I bet more people will encounter this between now and when fc7 is
released in April.  But that's just my 2c.

-Jeff

Comment 7 Chip Coldwell 2007-01-10 17:02:00 UTC
*** Bug 222132 has been marked as a duplicate of this bug. ***

Comment 8 Chip Coldwell 2007-01-11 22:05:03 UTC
Date: Thu, 11 Jan 2007 17:03:27 -0500
From: updates.com
To: coldwell
Subject: [Fedora Update] emacs-21.4-17.3 pushed

emacs-21.4-17.3 Testing update has been successfuly pushed for fc6


Comment 9 Jeff Norden 2007-01-18 21:39:25 UTC
emacs-21.4-17.3 works fine for me.
Thanks!