xenodm(1) sets the same standard environment variables as login(1) and
ssh(1) in the user session, except for MAIL.  Users may expect to
receive mail notifications in X and miss them as a result.

Here's the patch to add MAIL to the environment.
As a side effect, it will enable ksh(1)'s periodic mail checks.

Index: greeter/verify.c
===================================================================
RCS file: /cvs/xenocara/app/xenodm/greeter/verify.c,v
retrieving revision 1.10
diff -u -p -r1.10 verify.c
--- greeter/verify.c    4 Dec 2019 09:53:47 -0000       1.10
+++ greeter/verify.c    12 Jul 2021 22:46:12 -0000
@@ -45,6 +45,8 @@ from The Open Group.
 #include       <stdarg.h>
 #include       <bsd_auth.h>
 #include       <vis.h>
+#include       <limits.h>
+#include       <paths.h>
 
 #include       "greet.h"
 
@@ -56,6 +58,7 @@ static const char *envvars[] = {
 static char **
 userEnv (struct display *d, int useSystemPath, char *user, char *home, char 
*shell)
 {
+    char       mail[sizeof(_PATH_MAILDIR) + 1 + NAME_MAX];
     char       **env;
     const char **envvar;
     const char *str;
@@ -67,6 +70,8 @@ userEnv (struct display *d, int useSyste
     env = setEnv (env, "USER", user);    /* BSD */
     env = setEnv (env, "PATH", useSystemPath ? d->systemPath : d->userPath);
     env = setEnv (env, "SHELL", shell);
+    snprintf (mail, sizeof(mail), "%s/%s", _PATH_MAILDIR, user);
+    env = setEnv (env, "MAIL", mail);
     for (envvar = envvars; *envvar; envvar++)
     {
        str = getenv(*envvar);
Index: man/xenodm.man
===================================================================
RCS file: /cvs/xenocara/app/xenodm/man/xenodm.man,v
retrieving revision 1.13
diff -u -p -r1.13 xenodm.man
--- man/xenodm.man      13 Mar 2021 12:11:10 -0000      1.13
+++ man/xenodm.man      12 Jul 2021 22:46:12 -0000
@@ -1115,6 +1115,8 @@ the value of
 .It Ev SHELL
 the user's default shell (from
 .Xr getpwnam 3 )
+.It Ev MAIL
+the user's mailbox
 .It Ev XAUTHORITY
 may be set to a non-standard authority file
 .It Ev WINDOWPATH

Reply via email to