Bug in csh (affecting vi)

utzoo!decvax!duke!ucf-cs!lantz utzoo!decvax!duke!ucf-cs!lantz
Tue Apr 5 12:15:59 AEST 1983


There was a report in unix-wizards of a "bug in vi" which caused it to
give a "Too many file names" error, if a file name was given in a :e
command which contained an asterisk, even if only one file name matched.
The same error occurs if the filename starts with a tilde.

This was correctly found by Scott Bradner at Harvard University to be
caused by the fact that csh, which is used by vi to expand the filename,
was printing its prompt in addition to the filename.  I had also found
this prompt annoying when other programs, such as Franz Lisp, invoke the
shell to execute one command.

Bradner's correction was not exactly what was called for, however.  The csh
has a flag 'prompt' which is true if the shell is supposed to prompt for
input.  This flag is set by default, and is reset by certain flags, including
the -c flag, which is the one used by vi and Franz Lisp.  The problem is
that THIS FLAG IS NOT CHECKED by the shell before it prints a prompt!  The
check goes in the routine process, in sh.c.  Diffs follow.

						Philip Lantz
						duke!ucf-cs!lantz

*** sh.c.old	Mon Apr  4 22:33:47 1983
--- sh.c	Mon Apr  4 22:33:31 1983
***************
*** 669,673
  		if (neednote)
  			pnote();

! 		if (intty && evalvec == 0) {
  			mailchk();

--- 669,674 -----
  		if (neednote)
  			pnote();

! 	/* Check of prompt added by PRL, UCF, April 1983. */
! 		if (intty && prompt && evalvec == 0) {
  			mailchk();



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