4.[12]bsd mail e and v commands put Message in wrong place (with fix)

ado at elsie.UUCP ado at elsie.UUCP
Thu Sep 13 03:34:04 AEST 1984


Fixee:		/usr/src/cmd/ucbmail/edit.c in 4.1bsd; .../edit.c in 4.2bsd

Challenge:	When the 'e' and 'v' commands are used,
		mail tries to create a temporary file in the current working
		directory.  If there's no write permission in the directory,
		things grind to a halt.

Repeat by:
		echo This is a test | mail $user
		mkdir phony
		chmod 555 phony
		chdir phony
		mail
		e 1
		q
		chdir ..
		rm -f -r phony

		and note the "Message1: Permission denied" diagnostic you get.

Fix:		Put the temporary file in the user's home directory.
		Here are the relevant lines from "edit.c":
		.
		.
		.
		#ifdef OLDVERSION
			char edname[15], nbuf[10];
		#else
			char edname[PATHSIZE + 16], nbuf[10];
		#endif
		.
		.
		.
		#ifdef OLDVERSION
				cp2 = copy("Message", edname);
		#else
				cp2 = copy(homedir, edname);
				cp2 = copy("/Message", cp2);
		#endif
		.
		.
		.
--
	...decvax!seismo!umcp-cs!elsie!ado	(301) 496-5688
	(DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks)



More information about the Comp.bugs.4bsd.ucb-fixes mailing list