[comp.sys.ncr] Aspen ksh

jimh@aubsch.UUCP (Jim Hart) (01/19/90)

Art Neilson writes:
>The reason sh is spawned instead of ksh is the following alias at the
>top of your .env file in your home directory:
>
>alias -x vi='SHELL=/bin/sh vi'
>
>If you read the comments directly above the alias, it reads as follows:
>
>#  Change the vi invocations so /bin/sh is the shell escaped to.
>#This avoids the vi/ksh 8th bit conflict with ":!echo %" like commands.
>
>Note, this info is from the ASPEN ksh on my 386 box at home.  I don't
>have ksh yet for our Tower at work, I am *assuming* that the same
>problem would occur on any box.  If you don't use commands from
>vi like ':!echo %'.  The release notes state "KSH now accepts eight
>bit character sets transparently.  Previous versions used the eighth
>bit internally to keep track of quoting".  I have removed that alias
>from my .env with no problems, I never really tested commands like 
>the above.
>

I have checked my home directory.  There is no .env file.  Sounds like you
may be on the right track, though.  Is there an alias that I could put in
that would fix the problem?  Any other thoughts?

Thanks for responding;
-------------------------------------------------------------
Jim Hart                            uunet!usm3b2!aubsch!jimh
Dept. of Education                  Phone: 207-784-6431
P.O. Box 800, 23 High St.
Auburn, ME     04210
USA

bt455s10@uhccux.uhcc.hawaii.edu (Carl "Art" McIntosh) (01/20/90)

The ksh builtin command 'unalias' can be used to remove the vi alias
from the environment.  You can either enter in the command 'unalias vi'
at the shell prompt, or put that command in your .env/.profile.  You
may want to verify that vi is being automagically aliased by ksh via
the 'alias' builtin command.  Enter 'alias -x' at the shell prompt,
all exported aliases will be listed on your display.  If the solution
mentioned above doesn't work, you may try putting the following command
in your .env file: alias -x vi='SHELL=/bin/ksh vi'.  This is a waste of
resource having to run a sub-shell just to run vi, but that's what it's
doing anyway by running /bin/sh to run vi ...


-- 

Art Neilson		    | ARPA: manapua!pilikia!root@trout.nosc.mil
Bank of Hawaii Tech Support | UUCP: uunet!ucsd!nosc!manapua!pilikia!root

pim@cti-software.nl (Pim Zandbergen) (01/22/90)

bt455s10@uhccux.uhcc.hawaii.edu (Carl "Art" McIntosh) writes:

>If the solution
>mentioned above doesn't work, you may try putting the following command
>in your .env file: alias -x vi='SHELL=/bin/ksh vi'.  This is a waste of
>resource having to run a sub-shell just to run vi, but that's what it's
>doing anyway by running /bin/sh to run vi ...

This is not running /bin/sh to run vi, this simply is running vi
with a modified environment.
It does not run any sub-shell, but merely tells vi to use /bin/ksh
if it has to spawn a shell.
-- 
Pim Zandbergen                           domain : pim@cti-software.nl
CTI Software BV                          uucp   : uunet!mcsun!hp4nl!ctisbv!pim
Laan Copes van Cattenburch 70            phone  : +31 70 3542302
2585 GD The Hague, The Netherlands       fax    : +31 70 3512837

jimh@aubsch.UUCP (Jim Hart) (03/10/90)

	After getting used to using ksh in my MKS Toolkit at home, I decided
to revisit it on our 32/600 here at work.  It turns out that the problem is not
in the software, it is in the instructions.  The instructions say that the
path name is /bin/ksh.  In fact, the path name is /usr/bin/ksh as installed
on the Tower using Aspen's install script.  Once I set up /etc/passwd and the
SHELL variable correctly, it works quite well.  However, vi still won't call
it via the ':sh' command.  To get around this, I use the command ':!ksh', 
which works fine.  I plan to set up a macro to run this.

-------------------------------------------------------------
Jim Hart                            uunet!usm3b2!aubsch!jimh
Dept. of Education                  Phone: 207-784-6431
P.O. Box 800, 23 High St.
Auburn, ME     04210
USA

jim@aubsch.UUCP (Jim Hart) (03/20/90)

I had forgotten how many problems I had with this darned thing.  Thanks to
helpful suggestions from people on the net, I have ksh set up so it will spawn
a new Korn shell from 'vi' when I use the ':sh' command, or the :!.  
Unfortunately, in the ':!' process, I use the '%' symbol to get the current
file name.  This is not working.  Somehow, something is being passed to 'ksh'
that it can't handle.  It says the file (command, etc.) can't be found.  If I
type the name in, rather than using the '%', it works OK.  Anyone have any ideas
why 'ksh' can't handle %-substitution, but 'sh' can?
-------------------------------------------------------------
Jim Hart                            uunet!usm3b2!aubsch!jimh
Dept. of Education                  Phone: 207-784-6431
P.O. Box 800, 23 High St.
Auburn, ME     04210
USA

jsmithso@aut.UUCP (Jim Smithson) (03/23/90)

The problem is not with ksh but with vi. It seems that the vi code sets the
8th bit of the characters it passes to the shell. The Bourne shell always
stripped the 8th bit so it was not effected. The International version
( aka ksh-88 ) of Korn shell allows for 8 bit characters and does not
strip the bit. Therefore when vi expands the % field it sets the 8th bit
and passes it to ksh which cannot find any files which have those funny
characters in them.

 You can do one of the following to resolve this problem:

1. If you have the source code for vi you can add code to strip the 8th bit
   before the exec() call passes the command to the shell.
   I no longer have access to UNIX source so I can't tell you where I fixed
   this bug before. Look for the exec() calls and put the code there.

2. If you have the source code for ksh you can basically do the same thing
   but at the point where characters are read. Again, it was several years
   ago that I implemented this kludge and I don't have access to the source
   for ksh anymore.

3. Use another shell (eg. Bourne) for your vi shell escapes.

I'm not sure if the vi bug was fixed in System V release 3.
-- 
James R. Smithson	Ascom Autelca AG      CH-3073 Guemligen/Switzerland
E-mail: jsmithso@aut.UUCP   FAX: +41 31 527 745   Voice : +41 31 529 214
UUCP: ...!uunet!mcsun!cernvax!hslrswi!aut!jsmithso

guy@auspex.auspex.com (Guy Harris) (03/25/90)

>The problem is not with ksh but with vi. It seems that the vi code sets the
>8th bit of the characters it passes to the shell. The Bourne shell always
>stripped the 8th bit so it was not effected.

Until System V Release 3, at which point it stopped stripping the 8th
bit.

>I'm not sure if the vi bug was fixed in System V release 3.

It was definitely fixed by S5R3.1....