[net.bugs.4bsd] uucico aborts when it must create directories with long names

kurt@wucs.UUCP (Kurt Haserodt) (07/11/84)

Subject: uucico dies when trying to make a directory with long pathname
Index:	usr.bin/uucp/expfile.c 4.2BSD

Description:
	When sending a file by uucp with the -d option (create
	directory) set and a long directory name (~ >40 characters)
	the uucico that is creating the directory aborts (the abort
	doesn't work either--see a subsequent report).
	This situation arises frequently when sending directory
	hierarchies with uuto (from System V).  It is made even more
	insidious by the fact that with repeated tries it goes away
	(see fix for explanation).
Repeat-By:
	uucp -d file /usr/spool/uucppublic/receive/sys/dir1/dir2/dir3/file
		with dir3 nonexistent
Fix:
	The problem is due to the combination of two commands:
		mkdir <dir>; chmod 0777 <dir>
	sprintf'd into the array cmd[] for submission to a shell.
	This is in the function mkdirs().  Cmd[] is declared to be
	100 bytes, so you see if <dir> is over about 40 characters
	it is overrun.  In most cases the mkdir can succeed, but
	the chmod fails and so the call to the shell fails causing
	an abort.   The side not aborting will then merely TIMEOUT
	and the conversation fails.  Note that, since the mkdir succeeded,
	even though the chmod did not, the next time around the 
	directory exists, so it need not be created again, and the
	bug-ridden code is not re-executed.

	After the above, long-winded explanation follows a diff with the
	simple fix:

	*** /tmp/,RCSt1000481	Wed Jul 11 00:47:28 1984
	--- expfile.c	Wed Jul 11 00:47:20 1984
	***************
	*** 89,95
	  char *name;
	  {
		int ret, mask;
	! 	char cmd[100], dir[100];
		register char *p;
	  
		for (p = dir + 1;; p++) {

	--- 89,95 -----
	  char *name;
	  {
		int ret, mask;
	! 	char cmd[250], dir[100];
		register char *p;
	  
		for (p = dir + 1;; p++) {
-- 

Kurt Haserodt				..!ihnp4!wucs!kurt
Box 1045 Washington University		(314)-889-6160
St. Louis, MO 63130   USA