Bug in vi or ksh?
dlu at puffin.UUCP
dlu at puffin.UUCP
Fri Feb 6 06:11:48 AEST 1987
What is happening, I think, is that you are running the "International Korn
Shell" which uses an 8 bit character set. vi, erroneously I would say, passes
the file name to the shell with the high bits set and the shell dutifully gets
confused. There are two solutions - one is to fix vi, the other is to disable
the recognition of 8 bit characters in ksh. I quote from the README in
../ksh-i/src:
"This version passes 8-bit characters transparently. As a result programs
which assume that the shell will strip off the 8th bit will fail. In
particular, the vi command puts an 8th bit on the characters corresponding
to % when invoking a shell. The best solution is to fix the vi command.
However, if necessary, you can change the value of STRIP in sh/defs.h from
0377 to 0177 and rebuild a seven bit version of ksh-i."
The following fragment from ex_unix.c *seems* to be the sight of the dirty
deed (it was at line 74 on the 4.3beta version of ex):
case '%':
fp = savedfile;
if (*fp == 0) {
uxb[0] = 0;
error("No filename at to substitute for %%");
}
uexp:
printub++;
while (*fp) {
if (up >= &uxb[UXBSIZE])
goto tunix;
/*
* setting QUOTE confuses ksh-i
*
*up++ = *fp++ | QUOTE;
*/
*up++ = *fp++;
}
The expansion of '#' uses this code too, so this should be the only place
you need to fix. I haven't tested this yet, and I don't know why vi and
friends think that it is reasonable but it sure looks like the place...
Doug Urner dlu at puffin.USS.TEK.COM
(503)627-5037
More information about the Comp.bugs.sys5
mailing list