[news.software.b] System V.3 /bin/mail causes misbehaviour inside mail messages + fix-s

ccea3@rivm.UUCP (Adri Verhoef) (05/18/88)

  Ever since the news software got installed on my system V.3 machines,
we have a slight problem involving mail, especially when mail gets sent
by (some) news programs.
  Some of the news programs will send mail automatically (e.g. when a
control message arrives), and some of the programs are invoked by the
user when reading news: when one Replies via (electronic) mail, the
mail problem will show up here, too.

  The problem is that the header gets split when /bin/mail is invoked
without the new system V.3 `-s' option.

  There are some occurrences in the news sources of a call to a mailer,
of which "/bin/mail" is used by system V.
"/bin/mail" should on V.3 be invoked with the `-s' option.  Without `-s',
headers get split: immediately after the From<user><date> line a newline
is inserted, so that the recipients of the mail, when reading their mail,
don't see the "Subject:" line, because it isn't there where it should be.

  When reading the mail that got processed by the news programs, "mailx"
will generate a Status: line after the From line but before the inserted
blank line, and other mail programs will not see the Subject: line either.

  An example of a received message produced when mail lacks option `-s':
	From news Tue May 17 10:10 MET 1988

	Date: 17 May 88 09:09:57 GMT
	To: news
	Subject: Newsgroup comp.os.os9 changed from moderated to unmoderated
	Responding-System: rivm05.UUCP

	comp.os.os9 has been changed from moderated to unmoderated as requested by
	news

*With* the `-s' option, the blank line after the From line will disappear!

  Did anyone ever fix this for her/his system V.3 machine(s)?

  The fix follows.
  NOTICE: if you are running System V.3, then you should #define SYSV3
	in defs.h (with the help of localize.sh, which will copy defs.dist
	to defs.h).

  The fixes to the software according to me should be:
*** ../old/control.c
--- control.c
**************
*** 873,879
  #endif /* MMDF */
  		execl("/usr/bin/mail", "mail", sendto, (char *)NULL);
  		execl("/usr/ucb/mail", "mail", sendto, (char *)NULL);
  		execl("/bin/mail", "mail", sendto, (char *)NULL);
  		execl("/usr/bin/mailx", "mail", sendto, (char *)NULL);
  		_exit(1);
  	}
--- 873,883 -----
  #endif /* MMDF */
  		execl("/usr/bin/mail", "mail", sendto, (char *)NULL);
  		execl("/usr/ucb/mail", "mail", sendto, (char *)NULL);
+ #ifdef SYSV3
+ 		execl("/bin/mail", "mail", "-s", sendto, (char *)NULL);
+ #else /* !SYSV3 */
  		execl("/bin/mail", "mail", sendto, (char *)NULL);
+ #endif /* !SYSV3 */
  		execl("/usr/bin/mailx", "mail", sendto, (char *)NULL);
  		_exit(1);
  	}
*** ../old/defs.h
--- defs.h
**************
*** 67,72
  /* #define MULTICAST		/* If you want to be able to multicast news */
  /* #define BSD4_2		/* If you are running 4.2  or 4.3 BSD	*/
  /* #define BSD2_10		/* If you are running 2.10 BSD */
  #define LOCKF		/* If you have the lockf() sys call */
  /* #define LOCKING		/* If you have the locking() sys call */
  /* #define DOGETUSER		/* Always do 'getuser' so can't fake name */
--- 67,73 -----
  /* #define MULTICAST		/* If you want to be able to multicast news */
  /* #define BSD4_2		/* If you are running 4.2  or 4.3 BSD	*/
  /* #define BSD2_10		/* If you are running 2.10 BSD */
+ /* #define SYSV3		/* If you are running system V.3: mail -s user */
  #define LOCKF		/* If you have the lockf() sys call */
  /* #define LOCKING		/* If you have the locking() sys call */
  /* #define DOGETUSER		/* Always do 'getuser' so can't fake name */
*** ../old/readnews.c
--- readnews.c
**************
*** 93,99
  	}
  
  	if (!(MAILER = getenv("MAILER")))
  		MAILER = "mail";	/* was /bin/mail */
  
  #ifdef PAGE
  	if (myrc = getenv("PAGER"))
--- 93,103 -----
  	}
  
  	if (!(MAILER = getenv("MAILER")))
+ #ifdef SYSV3
+ 		MAILER = "/bin/mail -s";	/* was /bin/mail */
+ #else /* !SYSV3 */
  		MAILER = "mail";	/* was /bin/mail */
+ #endif /* !SYSV3 */
  
  #ifdef PAGE
  	if (myrc = getenv("PAGER"))
*** ../old/recmail.c
--- recmail.c
**************
*** 27,33
  
  #ifndef MAILER
  #define MAILER "/bin/mail"
  #endif
  char mailer[] = MAILER;
  
  #define MAXRECIPS 100
--- 27,39 -----
  
  #ifndef MAILER
  #define MAILER "/bin/mail"
+ #ifdef SYSV3
+ #define MAIL_S	"-s",
+ #endif /* SYSV3 */
  #endif
+ #ifndef MAIL_S
+ #define MAIL_S
+ #endif
  char mailer[] = MAILER;
  
  #define MAXRECIPS 100
**************
*** 217,223
  			(void) close(2);
  			(void) dup(1);
  		}
! 		execlp(mailer, mailer, recip, (char *)0);
  		perror(mailer);
  		exit(1);
  	}
--- 223,229 -----
  			(void) close(2);
  			(void) dup(1);
  		}
! 		execlp(mailer, mailer, MAIL_S recip, (char *)0);
  		perror(mailer);
  		exit(1);
  	}
*** ../old/sendnews.c
--- sendnews.c
**************
*** 48,54
  #ifdef M_XENIX
  	(void) sprintf(buffer, "/usr/bin/mail %s", *argv);
  #else /* XENIX is not quite Unix.... */
  	(void) sprintf(buffer, "/bin/mail %s", *argv);
  #endif /* !M_XENIX */
  #endif /* !SENDMAIL */
  #endif
--- 48,58 -----
  #ifdef M_XENIX
  	(void) sprintf(buffer, "/usr/bin/mail %s", *argv);
  #else /* XENIX is not quite Unix.... */
+ #ifdef SYSV3
+ 	(void) sprintf(buffer, "/bin/mail -s %s", *argv);
+ #else
  	(void) sprintf(buffer, "/bin/mail %s", *argv);
+ #endif /* !SYSV3 */
  #endif /* !M_XENIX */
  #endif /* !SENDMAIL */
  #endif
*** ../old/visual.c
--- visual.c
**************
*** 1091,1097
  	}
  	*q++ = '\0';
  	if ((MAILER = getenv("MAILER")) == NULL)
  		MAILER = "mail";
  	sprintf(rcbuf, MAILER, hptr->title);
  	sprintf(bfr, "%s %s", rcbuf, address);
  	arg[2] = bfr;
--- 1091,1101 -----
  	}
  	*q++ = '\0';
  	if ((MAILER = getenv("MAILER")) == NULL)
+ #ifdef SYSV3
+ 		MAILER = "/bin/mail -s";
+ #else /* !SYSV3 */
  		MAILER = "mail";
+ #endif /* !SYSV3 */
  	sprintf(rcbuf, MAILER, hptr->title);
  	sprintf(bfr, "%s %s", rcbuf, address);
  	arg[2] = bfr;

ccea3@rivm.UUCP (Adri Verhoef) (06/02/88)

  Ever since I installed the news software on our UNIX System V.3 machines,
we had a slight problem involving /bin/mail, especially when mail gets sent
by (some) news programs.
  Some of the news programs will send mail automatically (e.g. when a
control message arrives), and some of the programs are invoked by the
user when reading news (when one Replies via (electronic) mail).

  The problem is that the mail header gets split when /bin/mail is invoked
without the new System V.3 `-s' option.

  There are some occurrences in the news sources of a call to a mailer,
of which "/bin/mail" is used by System V.
  "/bin/mail" should on V.3 be invoked with the `-s' option.  Without `-s',
headers get split: immediately after the From<user><date>-line a newline
is inserted, so that the recipients of the mail, when reading their mail,
don't see the "Subject:" line, because this line is separated from the
From-line.
  (When reading the mail that got processed by the news programs, "mailx"
will generate a Status: line after the From line but before the inserted
blank line; other mail programs will not see the Subject: line either.)

  An example of a received message produced when mail lacks option `-s':
	From news Tue May 17 10:10 MET 1988

	Date: 17 May 88 09:09:57 GMT
	To: news
	Subject: Newsgroup comp.os.os9 changed from moderated to unmoderated
	Responding-System: rivm05.UUCP

	comp.os.os9 has been changed from moderated to unmoderated as requested by
	news

*With* the `-s' option, the blank line after the From-line will disappear!

  Did anyone ever fix this for her/his System V.3 machine(s)?

  The fixes to the news software follow.
  NOTICE: If you are running System V.3, then you should #define MAIL_S
	in defs.h (- with the help of localize.sh you should copy defs.dist
	to defs.h and modify defs.h according to your needs.  The modification
	to defs.dist that I included here adds "/* define MAIL_S ... */", so
	it does not #define MAIL_S; if you want to #define MAIL_S, you should
	take out the "/* ".  This will clear the problems involving `mail -s'.)

  Here are the fixes:
*** ../old/control.c
--- control.c
**************
*** 873,879
  #endif /* MMDF */
  		execl("/usr/bin/mail", "mail", sendto, (char *)NULL);
  		execl("/usr/ucb/mail", "mail", sendto, (char *)NULL);
! 		execl("/bin/mail", "mail", sendto, (char *)NULL);
  		execl("/usr/bin/mailx", "mail", sendto, (char *)NULL);
  		_exit(1);
  	}
--- 873,879 -----
  #endif /* MMDF */
  		execl("/usr/bin/mail", "mail", sendto, (char *)NULL);
  		execl("/usr/ucb/mail", "mail", sendto, (char *)NULL);
! 		execl("/bin/mail", "mail", MAIL_S sendto, (char *)NULL);
  		execl("/usr/bin/mailx", "mail", sendto, (char *)NULL);
  		_exit(1);
  	}
*** ../old/defs.dist
--- defs.dist
**************
*** 39,44
  #define HISTEXP	4*WEEKS	/* default no. of seconds to forget in		*/
  #define DFLTSUB "general,all.announce"	/* default subscription list	*/
  #define TMAIL	"/usr/ucb/Mail"	/* Mail program that understands -T	*/
  #define ADMSUB	"general,all.announce"	/* Mandatory subscription list	*/
  #define PAGE	"/usr/ucb/more"	/* Default pager			*/
  #define NOTIFY	"usenet"	/* Tell him about certain ctl messages	*/
--- 39,45 -----
  #define HISTEXP	4*WEEKS	/* default no. of seconds to forget in		*/
  #define DFLTSUB "general,all.announce"	/* default subscription list	*/
  #define TMAIL	"/usr/ucb/Mail"	/* Mail program that understands -T	*/
+ /* #define MAIL_S	"-s",	/* /bin/mail -s suppresses extra newline*/
  #define ADMSUB	"general,all.announce"	/* Mandatory subscription list	*/
  #define PAGE	"/usr/ucb/more"	/* Default pager			*/
  #define NOTIFY	"usenet"	/* Tell him about certain ctl messages	*/
*** ../old/readnews.c
--- readnews.c
**************
*** 93,99
  	}
  
  	if (!(MAILER = getenv("MAILER")))
  		MAILER = "mail";	/* was /bin/mail */
  
  #ifdef PAGE
  	if (myrc = getenv("PAGER"))
--- 93,103 -----
  	}
  
  	if (!(MAILER = getenv("MAILER")))
+ #ifdef MAIL_S
+ 		MAILER = "/bin/mail -s";	/* was /bin/mail */
+ #else /* !MAIL_S */
  		MAILER = "mail";	/* was /bin/mail */
+ #endif /* !MAIL_S */
  
  #ifdef PAGE
  	if (myrc = getenv("PAGER"))
*** ../old/recmail.c
--- recmail.c
**************
*** 27,33
  
  #ifndef MAILER
  #define MAILER "/bin/mail"
  #endif
  char mailer[] = MAILER;
  
  #define MAXRECIPS 100
--- 27,36 -----
  
  #ifndef MAILER
  #define MAILER "/bin/mail"
  #endif
+ #ifndef MAIL_S
+ #define MAIL_S	/* empty */
+ #endif
  char mailer[] = MAILER;
  
  #define MAXRECIPS 100
**************
*** 217,223
  			(void) close(2);
  			(void) dup(1);
  		}
! 		execlp(mailer, mailer, recip, (char *)0);
  		perror(mailer);
  		exit(1);
  	}
--- 220,226 -----
  			(void) close(2);
  			(void) dup(1);
  		}
! 		execlp(mailer, mailer, MAIL_S recip, (char *)0);
  		perror(mailer);
  		exit(1);
  	}
*** ../old/sendnews.c
--- sendnews.c
**************
*** 48,54
  #ifdef M_XENIX
  	(void) sprintf(buffer, "/usr/bin/mail %s", *argv);
  #else /* XENIX is not quite Unix.... */
  	(void) sprintf(buffer, "/bin/mail %s", *argv);
  #endif /* !M_XENIX */
  #endif /* !SENDMAIL */
  #endif
--- 48,58 -----
  #ifdef M_XENIX
  	(void) sprintf(buffer, "/usr/bin/mail %s", *argv);
  #else /* XENIX is not quite Unix.... */
+ #ifdef MAIL_S
+ 	(void) sprintf(buffer, "/bin/mail -s %s", *argv);
+ #else /* !MAIL_S */
  	(void) sprintf(buffer, "/bin/mail %s", *argv);
+ #endif /* !MAIL_S */
  #endif /* !M_XENIX */
  #endif /* !SENDMAIL */
  #endif