[comp.unix.wizards] Bourne shell logout on ^C?

jc@minya.UUCP (jc) (09/26/87)

Hi folks.  Here's my "Can you explain this?" puzzle of the day.
This one comes from a reasonably generic SysV.2 machine., for
what good that'll do ya.

I have two terminals here.  What they are don't really matter,
since the computer can't see the brand names; it can only see
the incoming bytes.  The funny behaviour is as follows:

When I type a ^C (CTRL-C) on terminal A, I get a new shell prompt.
When I type a ^C on terminal B, I get a login prompt.

As far as I can tell, both terminals are set up the same.  They both
are logged in with the same id, and the same .profile has been run
for both of them.  The only difference I know is that I have to type
"TERM=vt100" for terminal B, because it's not done correctly by the
inittab entry for the line.  [But this probably isn't relevant, since
the logout happens if ^C is the first thing I type after login.]

You are probably asking "What does `stty -a` say about the terminals?"  
Here's the answer:
	speed 9600 baud; line = 0; intr = ^c; quit = ^x; erase = ^h; 
	kill = ^z; eof = ^d; eol = ^`; swtch = ^`
	-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk 
	-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc 
	ixon ixany -ixoff 
	isig icanon -xcase echo echoe echok -echonl -noflsh 
	opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel 

I've gone over this on both terminals, and I can't see any difference
at all.  This isn't surprising, since they both derived from logins
with the same id, the same home directory, and the same .profiles.

So why does the shell log me off on the one and not the other?  Any
ideas where else I should look for differences?

If it's any help, there is another curious thing on terminal B.  When
I type "tail -f foo", the tail behaves as usual, showing me the file 
as it grows.  However, when I type ^C, it doesn't exit.  I've yet to
find a way to kill a "tail -f" from terminal B.  From terminal A it
works just fine.

I've run a hex-dump program from terminal B, and it verifies that ^C
comes in as hex 03, so it's not a transmission error.

One more thing.  I've examined the kernel-build stuff, and there
seems to be only one terminal driver in the system; it's the same 
routine for both terminals.

Hmmm....








-- 
	John Chambers <{adelie,ima,maynard}!minya!{jc,root}> (617/484-6393)

gwyn@brl-smoke.ARPA (Doug Gwyn ) (09/27/87)

In article <207@minya.UUCP> jc@minya.UUCP (jc) writes:
>When I type a ^C (CTRL-C) on terminal A, I get a new shell prompt.
>When I type a ^C on terminal B, I get a login prompt.

Try the following experiment:
Without changing ANYTHING else, swap the terminals (but not
the connecting cables).  See if the problem follows the
terminal.  If so, it may be dropping DTR when transmitting
^C, or something else equally silly.

>I've run a hex-dump program from terminal B, and it verifies that ^C
>comes in as hex 03, so it's not a transmission error.

This doesn't make sense.  You mean to say that ^C causes logout
only when typed at the shell prompt, but not when typed to some
other program?  According to your stty -a printout, it should
generate a signal (and not appear in the data stream) unless
some program changes the terminal handler modes.

ray@dsiramd.nz (Ray Brownrigg) (09/28/87)

In article <207@minya.UUCP> jc@minya.UUCP (jc) writes:
>Hi folks.  Here's my "Can you explain this?" puzzle of the day.
>
>When I type a ^C (CTRL-C) on terminal A, I get a new shell prompt.
>When I type a ^C on terminal B, I get a login prompt.

Could be something to do with the terminal dropping DTR whenever
you hit ^C. But if it does not actually log out from the middle
of the tail -f , then that is a puzzle.

-- 
Ray Brownrigg		UUCP: {utai!calgary,uunet}!vuwcomp!dsiramd!ray
Applied Maths Div, DSIR		ACSnet:	ray@dsiramd.nz[@munnari]
PO Box 1335			System:	OLIVETTI/AT&T 3B2/400B+, System V R3.0
Wellington, New Zealand			"UNX -rules -OK"

authorplaceholder@tiger.UUCP.UUCP (09/29/87)

> >When I type a ^C (CTRL-C) on terminal A, I get a new shell prompt.
> >When I type a ^C on terminal B, I get a login prompt.
> 
> Try the following experiment:
> Without changing ANYTHING else, swap the terminals (but not
> the connecting cables).  See if the problem follows the
> terminal.  If so, it may be dropping DTR when transmitting
> ^C, or something else equally silly.

  Check that you do not have a:   "trap 'kill -9 0' 2"   on terminal B's port
if it does not follow the terminal.  Just an idea...   (As a sysadm, I set up
some conditionals in /etc/profile depending on which hardwired port a terminal
is connected.)

Randy