Bug 101251 - /bin/mail segfaults after entering info and operating on mm
Summary: /bin/mail segfaults after entering info and operating on mm
Alias: None
Product: Red Hat Linux Beta
Classification: Retired
Component: mailx   
(Show other bugs)
Version: beta1
Hardware: x86_64 Linux
Target Milestone: ---
Assignee: Florian La Roche
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2003-07-30 14:07 UTC by Albert Fluegel
Modified: 2007-04-18 16:56 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-01 20:49:42 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Albert Fluegel 2003-07-30 14:07:15 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003

Description of problem:
after operating on mm the program segfaults.
It does not happen, if the current directory
is not writable, but if it is, here's the strace
open("mm", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
fcntl(3, F_GETFL)                       = 0x8401 (flags
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lseek(3, 0, SEEK_CUR)                   = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

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

How reproducible:

Steps to Reproduce:
1.type mail <any address>
2.enter subject
3.enter body and Ctrl-D
4. type Enter at the CC: prompt

Actual Results:  segfault

Expected Results:  mail sent

Additional info:

Comment 1 Florian La Roche 2003-08-01 11:20:14 UTC
/bin/mail is not really updated to current standards as a full email client.
It is better to use mutt/mozilla or other more maintained apps for this.


Florian La Roche

Comment 2 Albert Fluegel 2003-08-01 11:25:33 UTC
Please, PLEASE also think in automated large scale and the most important
thing: EXISTING and LIVING environments.
To send a mail automatically there is nothing simpler than piping
into /bin/mail or /bin/mailx. And in existing environments there
are probably thousands of scripts sending mail and they should also
work in the future. So i guess i have to do the analysis myself.
Anyway, no problem, but i hope, that when i find the problem, the
fix will be incorporated.

Comment 3 Florian La Roche 2003-08-01 12:20:59 UTC
/bin/mail should work fine to pipe into, but not as a full email client.
You seem to be using the severn beta, you might also want to check the
"taroon" beta, which might be a bit more stable for x86_64.
At least invoking /bin/mail and piping into it seems to work fine for me.


Florian La Roche

Comment 4 Albert Fluegel 2003-08-01 13:36:56 UTC
found it. seems to be a bug in the /usr/include/time.h header or
some subtle preprocessor definition in the mailx sources. Problem
is, that the declaration of ctime is not known in send.c. Adding
the following line to extern.h (hack) solves the problem:

extern char * ctime (__const time_t *);

If this declaration is not known, the compiler assumes a return type
of int, what is a 4 byte type while pointers are 8 byte. Boom.
Pushing send.c through the cpp results in an output, where the last
line from /usr/include/time.h is #122. The struct timespec is the
last thing i see, the following struct tm stuff is already gone,
don't know why.

Comment 5 Albert Fluegel 2003-08-01 14:07:21 UTC
Additional info:

creating a file that only contains
#include <time.h>
and running cpp on it the resulting output WILL contain
the ctime declaration (!?!)

Comment 6 Albert Fluegel 2003-08-01 15:25:23 UTC
Additional Info:
it has to do with the header files, especially the _TIME_H definition.
_TIME_H will under some circumstances not be defined (see /usr/include/time.h:25)
this is true, if sys/params.h is included before sys/time.h
The problem can also be solved changing the first 3 includes
in def.h from:

#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>

#include <time.h>
#include <sys/param.h>
#include <sys/stat.h>

but IMHO mailx should be a good guy and use autoconf ...
there all the trouble with time.h and sys/time.h is already

Comment 7 Florian La Roche 2003-08-01 20:49:42 UTC
New rpms with your fix are on http://people.redhat.com/laroche/

Thanks a lot for working on this,

Florian La Roche

Note You need to log in before you can comment on or make changes to this bug.