[comp.unix.sysv386] ksh acting weird under SCO Unix

ts@cup.portal.com (Tim W Smith) (11/04/90)

We obtained the V.3.2 release 2 update recently (I think that's
the one.  Whatever is the latest).  I decided not to install it,
however, because the development system update is backordered.

I extracted ksh from one of the installation floppies, however.
I did this by simply using tar to grab the file and then using
uncompress to get an executable.

When I try to run it, it behaves very strangely.  As long as I
only use shell builtin commands, all is well.  If I try to do
things that run other programs, however, after anywhere from
one to ten or so commands, the shell exits.  Worse, it kills
everything in the process group.  This also happens right away
if I try to run a command that is not found.

If I set the option to ignore EOF, it gets more interesting.
Before exiting and killing the process group, it says

	type 'exit' to logout

The above message is displayed exactly 11 times.  (I told
you that this was going to be strange).

It gets stranger.  After the process group exits, the terminal
is screwed up.

For example, if I do this from the console in single user mode,
after the process group dies, the message comes up that says to
entry the root password for single user mode or enter control-D
for multiuser mode.

An error message is then printed by login (I forget the exact
message (I'm typing this from home), but it is something about
an error on input).

At this point, the console is looping asking for the password
or control-D and then getting the error from login.

Keyboard input to the console does not seem to work at this
point.

Does anyone have any idea what is going on here?  Why does ksh exit
in the first place?  Why does it take the entire process group?  (Note
that this happens even if I run it by typing ksh at the sh prompt, so
it is not the process group leader)  Why does it print the 'exit' to
logout message exactly 11 times before going away?

						Tim Smith

seanf@sco.COM (Sean Fagan) (11/06/90)

In article <35582@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:
>We obtained the V.3.2 release 2 update recently (I think that's
>the one.  Whatever is the latest).  I decided not to install it,
>however, because the development system update is backordered.
>I extracted ksh from one of the installation floppies, however.

Uhm, why do you think this will work, at all?  In general, I would be leery
of installing parts of an OS onto another OS.

In this case, it really won't work (as you note).  3.2v2 adds working job
control, and ksh was built to use it (it works nicely, btw 8-)).  In
particular, ksh now will have every "command" be in a seperate process
group, so that job control works properly, if the '-m' option is set (set by
default in an interactive shell).

3.2.0 and 3.2.1 had some serious bugs in relation to job control; as a
result, none of our utilities used it.  3.2v2, however, has those bugs
fixed, so things do use it.

ksh exits, as you describe, because it no longer has access to the
controlling tty.  This is because of a bug in the code to change the pgrp of
tty's (fixed, obviously, in 3.2v2).  The bug causes, basicly, ksh to be
unable to get the tty back after it's run the process.  Because it can't get
to the tty, it dies (not necessarily gracefully, obviously 8-)).

Most of the problems you'll run into are related to that.

If you *must* use ksh, do a 'set +m' immediately when starting the shell
(either as the first command at the prompt, or in your $ENV file), or
upgrade to 3.2v2 (8-)).

-- 
-----------------+
Sean Eric Fagan  | "*Never* knock on Death's door:  ring the bell and 
seanf@sco.COM    |   run away!  Death hates that!"
uunet!sco!seanf  |     -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor")
(408) 458-1422   | Any opinions expressed are my own, not my employers'.

ts@cup.portal.com (Tim W Smith) (11/07/90)

<Uhm, why do you think this will work, at all?  In general, I would be leery
<of installing parts of an OS onto another OS.

The reason I wanted to use ksh was to be able to alias cd so that
I could have it set my prompt to include that name of my current
directory, since I usually have about 5 things going on in 5
virtual terminals.

I figured that since I was not going to try to use any fancy
features of ksh (job control, history, etc.), maybe it would
not actually do anything that doesn't work in 3.2.0.  It
seemed worth a shot.  And, considering that your suggestion
below in fact makes it work just fine, it appears that I
was not over optimistic here.

<If you *must* use ksh, do a 'set +m' immediately when starting the shell
<(either as the first command at the prompt, or in your $ENV file), or
<upgrade to 3.2v2 (8-)).

I've done this now and it seems to work fine (set +m, that is).  I
will upgrade to 3.2v2 as soon as two things happen.  1) The development
kit arrives (the rest arrived about a week after we ordered it, but
the development kit is backordered).  2) Comdex must pass.  I may do
crazy things like trying to run 3.2.2's ksh under 3.2.0, but even I
stop at switching operating systems in the middle of a development
effort for two very different drivers (ethernet and SCSI host
adaptor) just before Comdex! :-)

davidsen@sixhub.UUCP (Wm E. Davidsen Jr) (11/07/90)

In article <35582@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:

| When I try to run it, it behaves very strangely.  As long as I
| only use shell builtin commands, all is well.  If I try to do
| things that run other programs, however, after anywhere from
| one to ten or so commands, the shell exits.  Worse, it kills
| everything in the process group.  This also happens right away
| if I try to run a command that is not found.

	[ more weirdness ]

Try this: "set +m" and see if all your problems go away.
-- 
bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me

davidsen@sixhub.UUCP (Wm E. Davidsen Jr) (11/07/90)

In article <35665@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:

| The reason I wanted to use ksh was to be able to alias cd so that
| I could have it set my prompt to include that name of my current
| directory, since I usually have about 5 things going on in 5
| virtual terminals.

  You don't need an alias, just include the dirname in the prompt.

Ex 1:
  PS1='${PWD} $ '
  # just the dirname and a $

ex 2:
  PS1='${PWD#$HOME/}> '
  # in and subdir of your HOME dir, just the subdir name, else full path.
-- 
bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me