[net.bugs.4bsd] 4.xBSD /bin/csh bug fix wanted..

ks@ecn-ee.UUCP (02/08/84)

#N:ecn-ee:16700002:000:437
ecn-ee!ks    Feb  7 17:30:00 1984

Has anyone bothered to fix the bug in 4.x BSD /bin/csh that causes the following
to fail under some circumstances?

	eval `tset -s`

The circumstances include when at least one '*' character appears in the
TERMCAP description..
There seems to be a problem in the csh "eval" operator that makes this fail.
It may have something to do with having "noglob" set at the time..

Any pointers would be helpful..

					Kirk Smith
					Purdue EE

jsq@ut-sally.UUCP (John Quarterman) (02/09/84)

It's not a bug, it's a creature, when

	eval `tset -s`

fails because file-expansion wild cards are present.

Try something along these lines:

set noglob
eval `tset -s -n -e -k^U -m 'plugboard:?mime2a' -m 'network:?mime2a' -m 'dialup:?mime2a' -m 'unknown:?mime2a'`
unset noglob
-- 
John Quarterman, CS Dept., University of Texas, Austin, Texas
jsq@ut-sally.ARPA, jsq@ut-sally.UUCP, {ihnp4,seismo,ctvax}!ut-sally!jsq

ks@ecn-ee.UUCP (02/11/84)

#R:ecn-ee:16700002:ecn-ee:16700004:000:659
ecn-ee!ks    Feb 10 00:28:00 1984

Well, the output of tset -s looks something like:

set noglob;
setenv TERM adm3a ;
setenv TERMCAP 'la|adm3a|3a:am:cr=^M:do=^J:nl=^J:bl=^G:le=^H:bs:cm=\E=%+\040%+\040:cl=1^Z:co#80:ho=^^:li#24:ma=^K^P:nd=^L:up=^K:';
unset noglob;

noglob should be set while doing this.
Something is screwed up because it is in a line like

eval `tset -s`

The peculiarities:
	It works as long as there are no '*'s in the TERMCAP (maybe '?'s too).
	It fails to work every second time you try it.

The two suspect csh mechanisms are `back-quoting` and "eval".
My best guess is "eval" is messed up...
I really haven't dug into the sources (yet)...

					Kirk Smith
					Purdue EE

mark@cbosgd.UUCP (Mark Horton) (02/13/84)

It's not a bug in csh, it's a misfeature of eval.  You're supposed to
invoke tset like this
	set noglob
	eval `tset -s ....`
Even though tset outputs "set noglob" at the beginning, it doesn't do
any good because the line is scanned before the first set is done.
(It says so on the tset manual page, which I wish people would read
before reporting this "bug".)

This only matters for terminals that have shell special characters
in their termcaps, such as *.

The "every other time" behaviour happens because on the alternate
times, noglob is being set (and left set since the 2nd part bombs
out before it can be cleared) and then cleared (when it works fine).

porges@inmet.UUCP (02/13/84)

#R:ecn-ee:16700002:inmet:3000004:000:353
inmet!porges    Feb 11 14:58:00 1984

	It's no bug for eval `tset -s` to fail when there's a * in the 
TERMCAP;  the cshell is doing pattern matching.  What you need is

set noglob
eval `tset -s`
unset noglob

	And, if you ever get an AVT, whose TERMCAP has ! characters in it,
you have to fiddle with the histchars cshell variable before and after the tset
to prevent history substitution!