On Sun, 14 Nov 1999 15:31:46 -0500, Jim Knoble (jmknoble@???) wrote:
> On most systems, you can configure where login looks for mail (as well
> as all sorts of limits) in /etc/login.defs.
Been there, done that. If my /etc/login.defs:
MAIL_DIR /var/spool/exim
Adding a trailing "/" doesn't help either. $MAIL_DIR isn't set once I'm
logged in and in the shell however - is that correct? If it's only used
by login, then I guess it may well be.
I just grabbed the SRPM of util-linux (the package that contains
/bin/login). Extracted it, and taken a peep at login.c - these seems to
be the important bits:
...
char tmp[MAXPATHLEN];
/* avoid snprintf */
if (sizeof(_PATH_MAILDIR) + strlen(pwd->pw_name) + 1 < MAXPATHLEN) {
sprintf(tmp, "%s/%s", _PATH_MAILDIR, pwd->pw_name);
setenv("MAIL",tmp,0);
}
...
mail = getenv("MAIL");
if (mail && stat(mail, &st) == 0 && st.st_size != 0) {
printf(_("You have %smail.\n"),
(st.st_mtime > st.st_atime) ? _("new ") : "");
}
...
Now, the first bit there should set $MAIL, and the second bit looks at the
file specified by MAIL and if it has a nonzero length then says that
there's mail. Where does it say "No mail." if there isn't any - despite
some rgreping I can't find that in the util-linux source?
OK, we're getting somewhere now. $MAIL is set in /etc/profile to
/var/spool/exim/$USER. That gets done after login has completed, when
bash gets started. If I comment out the line in /etc/profile that does
that, then $MAIL is getting set to /var/spool/mail/$USER (by login I
assume). Looking further for the _PATH_MAILDIR used above, I find it in
lib/pathnames.h of the util-linux source:
#undef _PATH_MAILDIR
#define _PATH_MAILDIR VARPATH "/spool/mail"
In /usr/include/paths.h:
#define _PATH_MAILDIR "/var/spool/mail"
So, given everything I've tried, I guess RH have compiled /bin/login to
use /var/spool/mail. There doesn't seem to be any mention of
/etc/login.defs in the util-linux source, and as I've said, changing the
setting in there doesn't have an affect.
If that's the answer, then I can set the mail spool directory to
/var/spool/mail, and be content in having understood what's going on.
If not... I think I might take this elsewhere as it's not an exim specific
problem, and it's not strictly OT for this list.
Cheers,
- Stuart -