[torqueusers] maildomain patch (against 2.0.0p2)

Marcus R. Epperson mrepper at sandia.gov
Mon Dec 12 18:09:10 MST 2005


I'm not sure how the TMAILDOMAIN definition was supposed to be set before, but the attached patch makes it a regular configure option.  Also, when we defined it as "sandia.gov" it caused mail to be sent to job_owner at sandia.gov.  On our machines this meant e.g. "mrepper at login1@sandia.gov", which is clearly not what was intended.  This patch fixes that by using the euser field instead of job_owner (euser at sandia.gov == "mrepper at sandia.gov").

A similar patch was posted back in March (minus the configure changes), but it looks like it wasn't accepted for some reason.  It would help us if this option worked, since the hostnames of our job submission nodes are not usable as email domain names, and addresses with two "@"s in them don't help us either.

Note 1: I'm sure I could work around the current behavior with sufficient postfix hacking (I haven't figured out how yet, but I'm sure it's possible).  However, I would prefer to avoid that, and it seems this option is not usable in its current state anyway, so might as well fix it.  Please correct me if I'm wrong though.

Note 2: This patch won't change the current mail behavior unless the --maildomain=<domain> configure option is used.  And the user can still override it with qsub -M ... as before.

Thanks,
-- 
--------------------------------------------------
Marcus R. Epperson
SNL - 4324 (ICS)
--------------------------------------------------
--
-------------- next part --------------
diff -Naurp torque-2.0.0p2-orig/configure torque-2.0.0p2/configure
--- torque-2.0.0p2-orig/configure	2005-11-09 10:30:21.000000000 -0700
+++ torque-2.0.0p2/configure	2005-12-12 15:39:16.000000000 -0700
@@ -298,6 +298,12 @@ ac_help="$ac_help
   --enable-multiserver    enable multiple server daemons to communicate with
                           each mom. multiserver is disabled by default"
 
+ac_help="$ac_help
+
+  --maildomain=MAILDOMAIN override the default domain for outgoing mail messages,
+                          i.e. \"user at maildomain\".  the default maildomain is the
+                          hostname where the job was submitted from"
+
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
 # dashes changed to underlines.
@@ -459,6 +465,11 @@ EOF
   -libdir=* | --libdir=* | --libdi=* | --libd=*)
     libdir="$ac_optarg" ;;
 
+  -maildomain | --maildomain)
+    ac_prev=maildomain ;;
+  -maildomain=* | --maildomain=*)
+    maildomain="$ac_optarg" ;;
+
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
     ac_prev=mandir ;;
   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
@@ -1722,8 +1733,8 @@ fi
 
 # Check whether --maildomain was given.
 if test "${maildomain+set}" = set; then
-  cat >> confdefs.h <<\EOF
-#define TMAILDOMAIN ${maildomain}
+  cat >> confdefs.h <<EOF
+#define TMAILDOMAIN "$maildomain"
 EOF
 fi
 
@@ -4248,6 +4259,7 @@ s%@includedir@%$includedir%g
 s%@oldincludedir@%$oldincludedir%g
 s%@infodir@%$infodir%g
 s%@mandir@%$mandir%g
+s%@maildomain@%$maildomain%g
 s%@PBS_MKDIRS@%$PBS_MKDIRS%g
 s%@host@%$host%g
 s%@host_alias@%$host_alias%g
diff -Naurp torque-2.0.0p2-orig/src/server/svr_mail.c torque-2.0.0p2/src/server/svr_mail.c
--- torque-2.0.0p2-orig/src/server/svr_mail.c	2005-11-09 10:30:20.000000000 -0700
+++ torque-2.0.0p2/src/server/svr_mail.c	2005-12-12 15:57:14.000000000 -0700
@@ -216,12 +216,12 @@ void svr_mailowner(
   else 
     {
     /* no mail user list, just send to owner */
-
-    strcpy(mailto,pjob->ji_wattr[(int)JOB_ATR_job_owner].at_val.at_str);
-
     #ifdef TMAILDOMAIN
+      strcpy(mailto,pjob->ji_wattr[(int)JOB_ATR_euser].at_val.at_str);
       strcat(mailto,"@");
       strcat(mailto,TMAILDOMAIN);
+    #else
+      strcpy(mailto,pjob->ji_wattr[(int)JOB_ATR_job_owner].at_val.at_str);
     #endif /* TMAILDOMAIN */ 
     }
 


More information about the torqueusers mailing list